diff --git a/src/Graphics/Texture2D.cs b/src/Graphics/Texture2D.cs index 59becca8..582d8ffb 100644 --- a/src/Graphics/Texture2D.cs +++ b/src/Graphics/Texture2D.cs @@ -419,6 +419,8 @@ public static Texture2D FromStream(GraphicsDevice graphicsDevice, Stream stream) out height, out len ); + if ((pixels == IntPtr.Zero) || (width <= 0) || (height <= 0)) + throw new Exception("Decoding image failed!"); Texture2D result = new Texture2D( graphicsDevice, @@ -458,6 +460,8 @@ bool zoom height, zoom ); + if ((pixels == IntPtr.Zero) || (realWidth <= 0) || (realHeight <= 0)) + throw new Exception("Decoding image failed!"); Texture2D result = new Texture2D( graphicsDevice,