Fix #9562: Handle case of invalid action2 with zero results. (#9564)

This commit is contained in:
PeterN 2021-09-19 21:52:08 +01:00 committed by GitHub
parent b8f9e24189
commit 7e70ead396
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -5168,6 +5168,11 @@ static void NewSpriteGroup(ByteReader *buf)
grfmsg(6, "NewSpriteGroup: New SpriteGroup 0x%02X, %u loaded, %u loading",
setid, num_loaded, num_loading);
if (num_loaded + num_loading == 0) {
grfmsg(1, "NewSpriteGroup: no result, skipping invalid RealSpriteGroup");
break;
}
if (num_loaded + num_loading == 1) {
/* Avoid creating 'Real' sprite group if only one option. */
uint16 spriteid = buf->ReadWord();