Adds an error message for an invaild png
This commit is contained in:
parent
ab34b6142d
commit
7a3b0e180f
|
@ -254,6 +254,8 @@ 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("{file.FullName} appears not to be a valid image file.");
|
||||||
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