From e7a023edced99e3ae59712c231d9309b671c905b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 6 Jun 2015 11:12:37 +0200 Subject: [PATCH] catch an explicit null dereference --- OpenRA.Game/FileFormats/PngLoader.cs | 3 +++ 1 file changed, 3 insertions(+) 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);