Fix crash when trying to render an empty stamp

Empty stamps are those whose block width or height is 0. While they are technically valid and certain parts of the game are prepared to handle them, others aren't, so it's safest to just adjust the definition of valid stamps to exclude empty ones.
This commit is contained in:
Tamás Bálint Misius 2022-03-16 06:45:24 +01:00
parent 827bb568de
commit 6ff385d92d
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -646,6 +646,9 @@ void GameSave::readOPS(char * data, int dataLength)
if (inputData[5] != CELL) if (inputData[5] != CELL)
throw ParseException(ParseException::InvalidDimensions, "Incorrect CELL size"); throw ParseException(ParseException::InvalidDimensions, "Incorrect CELL size");
if (blockW <= 0 || blockH <= 0)
throw ParseException(ParseException::InvalidDimensions, "Save too small");
//Too large/off screen //Too large/off screen
if (blockX+blockW > XRES/CELL || blockY+blockH > YRES/CELL) if (blockX+blockW > XRES/CELL || blockY+blockH > YRES/CELL)
throw ParseException(ParseException::InvalidDimensions, "Save too large"); throw ParseException(ParseException::InvalidDimensions, "Save too large");