diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-08-08 19:46:30 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-08-08 19:46:30 -0400 |
commit | f3ff334c0893a314f8ecdcd4ca9ab62952159e11 (patch) | |
tree | 67c79d91545e355596fb79e5d0e04e10658ec51f /src | |
parent | e7b93e2ec2915f8124072add26eb799b74834743 (diff) | |
parent | 08eafe7d898780e22d01b69e820aaa665f3a2d56 (diff) | |
download | SMAPI-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.cs | 4 |
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; |