From d83a53e90575ca9cc4bd38df3dbd17dadd8ff83b Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 27 Jan 2022 11:25:22 -0500 Subject: [PATCH] Fixing private instance check. Fixes #2064 (#2065) --- crates/api_common/src/lib.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/api_common/src/lib.rs b/crates/api_common/src/lib.rs index 6dcdb58bd..a83f0071b 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(())