diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 29b6a4903..d2b3449c9 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -4746,6 +4746,7 @@ static void FeatureChangeInfo(ByteReader *buf) /* GSF_ROADTYPES */ RoadTypeChangeInfo, /* GSF_TRAMTYPES */ TramTypeChangeInfo, }; + static_assert(GSF_END == lengthof(handler)); uint8 feature = buf->ReadByte(); uint8 numprops = buf->ReadByte(); @@ -4760,7 +4761,7 @@ static void FeatureChangeInfo(ByteReader *buf) grfmsg(6, "FeatureChangeInfo: Feature 0x%02X, %d properties, to apply to %d+%d", feature, numprops, engine, numinfo); - if (feature >= lengthof(handler) || handler[feature] == nullptr) { + if (handler[feature] == nullptr) { if (feature != GSF_CARGOES) grfmsg(1, "FeatureChangeInfo: Unsupported feature 0x%02X, skipping", feature); return; } |