From 52d970f312f22b149f2fb23834982c690691a9dc Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 28 Jul 2024 01:36:12 +0300 Subject: [PATCH] gazellegames-api: fix parsing error when no results are returned Fixes #15513 --- .../Indexers/Definitions/GazelleGamesAPI.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Jackett.Common/Indexers/Definitions/GazelleGamesAPI.cs b/src/Jackett.Common/Indexers/Definitions/GazelleGamesAPI.cs index 677dd1f69..899946de2 100644 --- a/src/Jackett.Common/Indexers/Definitions/GazelleGamesAPI.cs +++ b/src/Jackett.Common/Indexers/Definitions/GazelleGamesAPI.cs @@ -258,7 +258,8 @@ namespace Jackett.Common.Indexers.Definitions await ApplyConfiguration(null); response = await RequestWithCookiesAndRetryAsync(searchUrl); } - else if (response.ContentString != null && response.ContentString.Contains("failure") && useApiKey) + + if (response.ContentString != null && response.ContentString.Contains("failure") && useApiKey) { // reason for failure should be explained. var jsonError = JObject.Parse(response.ContentString); @@ -270,7 +271,12 @@ namespace Jackett.Common.Indexers.Definitions { var json = JObject.Parse(response.ContentString); - foreach (var gObj in JObject.FromObject(json["response"])) + if (json.Value("response") is not JObject results) + { + return releases; + } + + foreach (var gObj in results) { var groupId = int.Parse(gObj.Key); var group = gObj.Value as JObject;