Fix null dereference when file does not exist

Signed-off-by: solidDoWant <fred.heinecke@yahoo.com>
This commit is contained in:
solidDoWant 2025-04-27 21:19:21 +00:00 committed by Zoe Roux
parent 5ebbd2b565
commit a39baa1b50

View File

@ -202,9 +202,10 @@ public class ThumbnailsManager(
public async Task SetUserImage(Guid userId, Stream? image)
{
var filePath = $"/metadata/user/{userId}.webp";
if (image == null && await storage.DoesExist(filePath))
if (image == null)
{
await storage.Delete(filePath);
if (await storage.DoesExist(filePath))
await storage.Delete(filePath);
return;
}