diff --git a/BTCPayServer/Security/BitpayAuthentication.cs b/BTCPayServer/Security/BitpayAuthentication.cs index 612937a1a..c09fd0656 100644 --- a/BTCPayServer/Security/BitpayAuthentication.cs +++ b/BTCPayServer/Security/BitpayAuthentication.cs @@ -88,7 +88,8 @@ namespace BTCPayServer.Security { claims.Add(new Claim(Policies.CanCreateInvoice.Key, storeId)); var store = await _StoreRepository.FindStore(storeId); - if (anonymous && !store.GetStoreBlob().AnyoneCanInvoice) + if (store == null || + (anonymous && !store.GetStoreBlob().AnyoneCanInvoice)) { return AuthenticateResult.Fail("Invalid credentials"); }