Fixed potential issue with the RealDebrid data mapper.

This commit is contained in:
Roger Far 2021-11-24 07:59:14 -07:00
parent eb39a88e78
commit 763ce5a036

View file

@ -224,8 +224,18 @@ namespace RdtClient.Service.Services.TorrentClients
{ {
try try
{ {
if (torrent == null)
{
return null;
}
var rdTorrent = await GetInfo(torrent.RdId); var rdTorrent = await GetInfo(torrent.RdId);
if (rdTorrent == null)
{
return torrent;
}
if (!String.IsNullOrWhiteSpace(rdTorrent.Filename)) if (!String.IsNullOrWhiteSpace(rdTorrent.Filename))
{ {
torrent.RdName = rdTorrent.Filename; torrent.RdName = rdTorrent.Filename;
@ -278,9 +288,12 @@ namespace RdtClient.Service.Services.TorrentClients
catch (Exception ex) catch (Exception ex)
{ {
if (ex.Message == "Resource not found") if (ex.Message == "Resource not found")
{
if (torrent != null)
{ {
torrent.RdStatusRaw = "deleted"; torrent.RdStatusRaw = "deleted";
} }
}
else else
{ {
throw; throw;