From: Dessalines Date: Thu, 27 Jan 2022 16:25:22 +0000 (-0500) Subject: Fixing private instance check. Fixes #2064 (#2065) X-Git-Url: http://these/git/%22https:/image.com/%7BcommunityRSSUrl%28?a=commitdiff_plain;h=d83a53e90575ca9cc4bd38df3dbd17dadd8ff83b;p=lemmy.git Fixing private instance check. Fixes #2064 (#2065) --- diff --git a/crates/api_common/src/lib.rs b/crates/api_common/src/lib.rs index 6dcdb58b..a83f0071 100644 --- a/crates/api_common/src/lib.rs +++ b/crates/api_common/src/lib.rs @@ -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(())