gazellegamesapi: fix NullRef when "Torrents" is not present in the response

This commit is contained in:
Bogdan
2024-12-29 22:57:53 +02:00
parent 668091af05
commit 85b6ee8b69

View File

@@ -285,7 +285,7 @@ namespace Jackett.Common.Indexers.Definitions
var groupId = int.Parse(gObj.Key); var groupId = int.Parse(gObj.Key);
var group = gObj.Value as JObject; var group = gObj.Value as JObject;
if (group["Torrents"].Type == JTokenType.Array && group["Torrents"] is JArray { Count: 0 }) if (group["Torrents"] is not JObject groupTorrents)
{ {
continue; continue;
} }
@@ -295,7 +295,9 @@ namespace Jackett.Common.Indexers.Definitions
.Distinct() .Distinct()
.ToArray(); .ToArray();
foreach (var tObj in JObject.FromObject(group["Torrents"])) var torrents = JObject.FromObject(groupTorrents);
foreach (var tObj in torrents)
{ {
var torrent = tObj.Value as JObject; var torrent = tObj.Value as JObject;