mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-21 14:04:12 +01:00
FileService: Null-check stored file before removal (#4535)
This commit is contained in:
parent
248401f534
commit
3cdb4f5b2a
1 changed files with 2 additions and 2 deletions
|
@ -120,8 +120,8 @@ namespace BTCPayServer.Storage.Services
|
|||
return;
|
||||
var provider = GetProvider(settings);
|
||||
var storedFile = await _fileRepository.GetFile(fileId);
|
||||
if (string.IsNullOrEmpty(userId) ||
|
||||
storedFile.ApplicationUserId.Equals(userId, StringComparison.InvariantCultureIgnoreCase))
|
||||
if (storedFile != null && (string.IsNullOrEmpty(userId) ||
|
||||
storedFile.ApplicationUserId.Equals(userId, StringComparison.InvariantCultureIgnoreCase)))
|
||||
{
|
||||
await provider.RemoveFile(storedFile, settings);
|
||||
await _fileRepository.RemoveFile(storedFile);
|
||||
|
|
Loading…
Add table
Reference in a new issue