1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-10-26 22:52:40 +02:00

Prevent NullRef when deleting missing backups

(cherry picked from commit 0ff0fe2e68f3abf7b8e4d6bf0c1e9dee4eb68227)

Closes #8721
This commit is contained in:
Bogdan 2023-06-17 02:08:40 +03:00
parent cb21fe535d
commit d008768fff

View File

@ -20,7 +20,7 @@ public class BackupController : Controller
private readonly IAppFolderInfo _appFolderInfo;
private readonly IDiskProvider _diskProvider;
private static readonly List<string> ValidExtensions = new List<string> { ".zip", ".db", ".xml" };
private static readonly List<string> ValidExtensions = new () { ".zip", ".db", ".xml" };
public BackupController(IBackupService backupService,
IAppFolderInfo appFolderInfo,
@ -53,6 +53,12 @@ public List<BackupResource> GetBackupFiles()
public void DeleteBackup(int id)
{
var backup = GetBackup(id);
if (backup == null)
{
throw new NotFoundException();
}
var path = GetBackupPath(backup);
if (!_diskProvider.FileExists(path))