# HG changeset patch # User rubidium # Date 2014-07-21 18:03:05 # Node ID 52da6ae0d4f82c9d1ff0c6d7b0be265532675bb9 # Parent 439d426c94f72fde15138fe7f14a44a466c75c0f (svn r26699) -Fix-ish: do not crash when trying to show an error about vehicle in a NewGRF and the NewGRF was not loaded at all diff --git a/src/vehicle.cpp b/src/vehicle.cpp --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -235,6 +235,9 @@ void ShowNewGrfVehicleError(EngineID eng const Engine *e = Engine::Get(engine); GRFConfig *grfconfig = GetGRFConfig(e->GetGRFID()); + /* Missing GRF. Nothing useful can be done in this situation. */ + if (grfconfig == NULL) return; + if (!HasBit(grfconfig->grf_bugs, bug_type)) { SetBit(grfconfig->grf_bugs, bug_type); SetDParamStr(0, grfconfig->GetName());