From fec5ad664c0cc56f35133c98e638417a8b97c6ac Mon Sep 17 00:00:00 2001 From: glax Date: Wed, 13 Sep 2023 23:02:36 +0200 Subject: [PATCH] Fix possible nullreference --- Tranga/MangaConnectors/Manganato.cs | 2 ++ Tranga/MangaConnectors/Mangaworld.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Tranga/MangaConnectors/Manganato.cs b/Tranga/MangaConnectors/Manganato.cs index 06af92a..6b3cd23 100644 --- a/Tranga/MangaConnectors/Manganato.cs +++ b/Tranga/MangaConnectors/Manganato.cs @@ -181,6 +181,8 @@ public class Manganato : MangaConnector if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300) return requestResult.statusCode; + if (requestResult.htmlDocument is null) + return HttpStatusCode.InternalServerError; string[] imageUrls = ParseImageUrlsFromHtml(requestResult.htmlDocument); string comicInfoPath = Path.GetTempFileName(); diff --git a/Tranga/MangaConnectors/Mangaworld.cs b/Tranga/MangaConnectors/Mangaworld.cs index 2e74b2e..4b36c71 100644 --- a/Tranga/MangaConnectors/Mangaworld.cs +++ b/Tranga/MangaConnectors/Mangaworld.cs @@ -159,6 +159,8 @@ public class Mangaworld: MangaConnector if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300) return requestResult.statusCode; + if (requestResult.htmlDocument is null) + return HttpStatusCode.InternalServerError; string[] imageUrls = ParseImageUrlsFromHtml(requestResult.htmlDocument); string comicInfoPath = Path.GetTempFileName();