summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();