Merge pull request #869 from atravita-mods/patch-1
Add error message for invalid PNG
This commit is contained in:
commit
f3ff334c08
|
@ -254,6 +254,10 @@ namespace StardewModdingAPI.Framework.ContentManagers
|
||||||
{
|
{
|
||||||
using FileStream stream = File.OpenRead(file.FullName);
|
using FileStream stream = File.OpenRead(file.FullName);
|
||||||
using SKBitmap bitmap = SKBitmap.Decode(stream);
|
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);
|
rawPixels = SKPMColor.PreMultiply(bitmap.Pixels);
|
||||||
width = bitmap.Width;
|
width = bitmap.Width;
|
||||||
height = bitmap.Height;
|
height = bitmap.Height;
|
||||||
|
|
Loading…
Reference in New Issue