From 3d3fb76b7e1a1eab99a6155684485ad607c93fad Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 21 Jul 2014 18:03:05 +0000 Subject: [PATCH] (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 --- src/vehicle.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 4cf6e642e1..bd8d41b2bf 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -235,6 +235,9 @@ void ShowNewGrfVehicleError(EngineID engine, StringID part1, StringID part2, GRF 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());