From 2b0421f69295a774965d0ebbdb08ef904e1e8b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 31 May 2015 10:18:58 +0200 Subject: [PATCH] throw before triggering an NRE by accessing a null array --- 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 dce8de20b3..3652b3b428 100644 --- a/OpenRA.Game/FileFormats/PngLoader.cs +++ b/OpenRA.Game/FileFormats/PngLoader.cs @@ -130,6 +130,9 @@ namespace OpenRA.FileFormats bitmap.UnlockBits(bits); + if (palette == null) + throw new InvalidDataException("Non-Palette indexed PNG are not supported."); + using (var temp = new Bitmap(1, 1, PixelFormat.Format8bppIndexed)) { var cp = temp.Palette;