Added palette size check to prevent crash if palette is corrupted

This commit is contained in:
MaxED 2012-08-24 01:18:25 +00:00
parent 91080d618a
commit 4d26e1acdc

View file

@ -145,7 +145,12 @@ namespace CodeImp.DoomBuilder.Data
if((foundfile != null) && FileExists(foundfile))
{
MemoryStream stream = LoadFile(foundfile);
palette = new Playpal(stream);
if(stream.Length > 767) {//mxd
palette = new Playpal(stream);
} else {
General.ErrorLogger.Add(ErrorType.Warning, "Warning: invalid palette '"+foundfile+"'");
}
stream.Dispose();
}