From 06fe98323a4e2ef0e4727a49f34073f95ba3d2c4 Mon Sep 17 00:00:00 2001 From: Glax Date: Mon, 22 Apr 2024 22:09:43 +0200 Subject: [PATCH] Fix crashing when comparing old Manga (missing websiteUrl) --- Tranga/Manga.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Tranga/Manga.cs b/Tranga/Manga.cs index 89f2596..32ea54b 100644 --- a/Tranga/Manga.cs +++ b/Tranga/Manga.cs @@ -44,12 +44,12 @@ public struct Manga public float latestChapterDownloaded { get; set; } public float latestChapterAvailable { get; set; } - public string websiteUrl { get; private set; } + public string? websiteUrl { get; private set; } private static readonly Regex LegalCharacters = new (@"[A-Za-zÀ-ÖØ-öø-ÿ0-9 \.\-,'\'\)\(~!\+]*"); [JsonConstructor] - public Manga(string sortName, List authors, string? description, Dictionary altTitles, string[] tags, string? coverUrl, string? coverFileNameInCache, Dictionary? links, int? year, string? originalLanguage, string publicationId, ReleaseStatusByte releaseStatus, string? websiteUrl, string? folderName = null, float? ignoreChaptersBelow = 0) + public Manga(string sortName, List authors, string? description, Dictionary altTitles, string[] tags, string? coverUrl, string? coverFileNameInCache, Dictionary? links, int? year, string? originalLanguage, string publicationId, ReleaseStatusByte releaseStatus, string? websiteUrl = null, string? folderName = null, float? ignoreChaptersBelow = 0) { this.sortName = sortName; this.authors = authors; @@ -71,6 +71,7 @@ public struct Manga this.latestChapterDownloaded = 0; this.latestChapterAvailable = 0; this.releaseStatus = releaseStatus; + this.status = Enum.GetName(releaseStatus) ?? ""; this.websiteUrl = websiteUrl; } @@ -99,7 +100,7 @@ public struct Manga this.sortName == compareManga.sortName && this.latestChapterAvailable.Equals(compareManga.latestChapterAvailable) && this.authors.All(a => compareManga.authors.Contains(a)) && - this.websiteUrl.Equals(compareManga.websiteUrl) && + (this.websiteUrl??"").Equals(compareManga.websiteUrl) && this.tags.All(t => compareManga.tags.Contains(t)); }