From 605f95294c07558c1c23f0ceab2a6da00282dde5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Tue, 30 Jun 2015 22:31:11 +0200 Subject: [PATCH] fix a null reference exception --- 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 e3c9cc45e1..414258120a 100644 --- a/OpenRA.Game/FileFormats/PngLoader.cs +++ b/OpenRA.Game/FileFormats/PngLoader.cs @@ -84,6 +84,9 @@ namespace OpenRA.FileFormats case "tRNS": { + if (palette == null) + throw new InvalidDataException("Non-Palette indexed PNG are not supported."); + for (var i = 0; i < length; i++) palette[i] = Color.FromArgb(cr.ReadByte(), palette[i]); }