throw before triggering an NRE by accessing a null array

This commit is contained in:
Matthias Mailänder
2015-05-31 10:18:58 +02:00
parent a12e6a191b
commit 2b0421f692

View File

@@ -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;