diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Chromaprint.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Chromaprint.cs index dd680eb..950679a 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Chromaprint.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Chromaprint.cs @@ -188,9 +188,23 @@ public static class Chromaprint // Read each stringified uint. result.EnsureCapacity(raw.Length); - foreach (var rawNumber in raw) + + try { - result.Add(Convert.ToUInt32(rawNumber, CultureInfo.InvariantCulture)); + foreach (var rawNumber in raw) + { + result.Add(Convert.ToUInt32(rawNumber, CultureInfo.InvariantCulture)); + } + } + catch (FormatException) + { + // Occurs when the cached fingerprint is corrupt. + Logger?.LogDebug( + "Cached fingerprint for {Path} ({Id}) is corrupt, ignoring cache", + episode.Path, + episode.EpisodeId); + + return false; } fingerprint = result.AsReadOnly();