# HG changeset patch # User rubidium # Date 1208004676 0 # Node ID 4b63a1a768fe3a286502f91b1a048eb64ebc87e2 # Parent f30afabf2b458b38baa0676a4891a2e3f3dbd873 (svn r12669) -Fix (r12667): crash when a vehicle has never been to a station and the load percentage conditional variable is evaluated. diff --git a/src/vehicle.cpp b/src/vehicle.cpp --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2150,13 +2150,13 @@ bool loading = false; const Vehicle *u = v; - const Station *st = GetStation(v->last_station_visited); + const Station *st = v->last_station_visited != INVALID_STATION ? GetStation(v->last_station_visited) : NULL; /* Count up max and used */ for (; v != NULL; v = v->Next()) { count += v->cargo.Count(); max += v->cargo_cap; - if (v->cargo_cap != 0) { + if (v->cargo_cap != 0 && color != NULL) { unloading += HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) ? 1 : 0; loading |= !(u->current_order.GetUnloadType() & OUFB_UNLOAD) && st->goods[v->cargo_type].days_since_pickup != 255; cars++;