added null check for torrent properties

This commit is contained in:
Flaminel
2025-02-16 03:37:50 +02:00
parent 596a5aed8d
commit 3fe7c3de1a
@@ -245,6 +245,12 @@ public class QBitService : DownloadService, IQBitService
{ {
TorrentProperties? torrentProperties = await _client.GetTorrentPropertiesAsync(download.Hash); TorrentProperties? torrentProperties = await _client.GetTorrentPropertiesAsync(download.Hash);
if (torrentProperties is null)
{
_logger.LogDebug("failed to find torrent properties in the download client | {name}", download.Name);
return;
}
bool isPrivate = torrentProperties.AdditionalData.TryGetValue("is_private", out var dictValue) && bool isPrivate = torrentProperties.AdditionalData.TryGetValue("is_private", out var dictValue) &&
bool.TryParse(dictValue?.ToString(), out bool boolValue) bool.TryParse(dictValue?.ToString(), out bool boolValue)
&& boolValue; && boolValue;