summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-08-08 19:46:30 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-08-08 19:46:30 -0400
commitf3ff334c0893a314f8ecdcd4ca9ab62952159e11 (patch)
tree67c79d91545e355596fb79e5d0e04e10658ec51f /src
parente7b93e2ec2915f8124072add26eb799b74834743 (diff)
parent08eafe7d898780e22d01b69e820aaa665f3a2d56 (diff)
downloadSMAPI-f3ff334c0893a314f8ecdcd4ca9ab62952159e11.tar.gz
SMAPI-f3ff334c0893a314f8ecdcd4ca9ab62952159e11.tar.bz2
SMAPI-f3ff334c0893a314f8ecdcd4ca9ab62952159e11.zip
Merge pull request #869 from atravita-mods/patch-1
Add error message for invalid PNG
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI/Framework/ContentManagers/ModContentManager.cs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
index f3cf05d9..8ecbc4cc 100644
--- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
+++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
@@ -254,6 +254,10 @@ namespace StardewModdingAPI.Framework.ContentManagers
{
using FileStream stream = File.OpenRead(file.FullName);
using SKBitmap bitmap = SKBitmap.Decode(stream);
+
+ if (bitmap is null)
+ throw new InvalidDataException($"Failed to load {file.FullName}. This doesn't seem to be a valid PNG image.");
+
rawPixels = SKPMColor.PreMultiply(bitmap.Pixels);
width = bitmap.Width;
height = bitmap.Height;