summaryrefslogtreecommitdiff
path: root/src/newgrf_engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newgrf_engine.cpp')
-rw-r--r--src/newgrf_engine.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index 7e21cc8ec..1d21eb252 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -820,8 +820,10 @@ static const SpriteGroup *GetVehicleSpriteGroup(EngineID engine, const Vehicle *
if (v == NULL) {
cargo = GC_PURCHASE;
} else {
- cargo = GetCargo(v->cargo_type)->bitnum;
- assert(cargo != GC_INVALID);
+ const CargoSpec *cs = GetCargo(v->cargo_type);
+ assert(cs->IsValid());
+
+ cargo = cs->bitnum;
if (v->type == VEH_Train) {
group = GetWagonOverrideSpriteSet(engine, cargo, v->u.rail.first_engine);