summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeterN <peter1138@openttd.org>2021-09-19 21:52:08 +0100
committerGitHub <noreply@github.com>2021-09-19 21:52:08 +0100
commit7e70ead39629c557c4580d1d66be0cdcc37480ec (patch)
treead4c695bff2c73c28cbfa25ab8f32b6e7dce00c6 /src
parentb8f9e24189aa5d62ccf4d3e7bc3ccbd23e57911e (diff)
downloadopenttd-7e70ead39629c557c4580d1d66be0cdcc37480ec.tar.xz
Fix #9562: Handle case of invalid action2 with zero results. (#9564)
Diffstat (limited to 'src')
-rw-r--r--src/newgrf.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 5ceadfd96..8a88e5203 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -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();