diff --git a/OpenRA.Game/FileFormats/PngLoader.cs b/OpenRA.Game/FileFormats/PngLoader.cs index 3652b3b428..e3c9cc45e1 100644 --- a/OpenRA.Game/FileFormats/PngLoader.cs +++ b/OpenRA.Game/FileFormats/PngLoader.cs @@ -99,6 +99,9 @@ namespace OpenRA.FileFormats case "IEND": { + if (bitmap == null) + throw new InvalidDataException("Image header not found."); + var bits = bitmap.LockBits(bitmap.Bounds(), ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);