fix exception which can be thrown if the store is not found

This commit is contained in:
nicolas.dorier 2019-03-25 12:24:48 +09:00
parent 312c7b7193
commit a09c6d51e6

View file

@ -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");
}