]> Untitled Git - lemmy.git/commitdiff
Fixing private instance check. Fixes #2064 (#2065)
authorDessalines <dessalines@users.noreply.github.com>
Thu, 27 Jan 2022 16:25:22 +0000 (11:25 -0500)
committerGitHub <noreply@github.com>
Thu, 27 Jan 2022 16:25:22 +0000 (16:25 +0000)
crates/api_common/src/lib.rs

index 6dcdb58bd7311ac5feb907dc7d7d4d3d5f47ff3d..a83f0071b300251b45ade975ca7203b3efde491b 100644 (file)
@@ -280,9 +280,13 @@ pub async fn check_private_instance(
   pool: &DbPool,
 ) -> Result<(), LemmyError> {
   if local_user_view.is_none() {
-    let site = blocking(pool, Site::read_simple).await??;
-    if site.private_instance {
-      return Err(LemmyError::from_message("instance_is_private"));
+    let site = blocking(pool, Site::read_simple).await?;
+
+    // The site might not be set up yet
+    if let Ok(site) = site {
+      if site.private_instance {
+        return Err(LemmyError::from_message("instance_is_private"));
+      }
     }
   }
   Ok(())