From 53712fb06be78cb6383ed8a54467dad7aebbf369 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 18 Apr 2015 02:46:23 +0300 Subject: [PATCH] Don't crash if a train has no router --- source/libr2c2/trainrouteplanner.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/libr2c2/trainrouteplanner.cpp b/source/libr2c2/trainrouteplanner.cpp index 7aba4a6..0594b7a 100644 --- a/source/libr2c2/trainrouteplanner.cpp +++ b/source/libr2c2/trainrouteplanner.cpp @@ -249,6 +249,9 @@ TrainRoutePlanner::TrainRoutingInfo::TrainRoutingInfo(Train &t): router(train->get_ai_of_type()), has_duration(false) { + if(!router) + return; + if(unsigned n_wps = router->get_n_waypoints()) { waypoints.reserve(n_wps), -- 2.43.0