From: Mikko Rasa Date: Fri, 17 Apr 2015 23:46:23 +0000 (+0300) Subject: Don't crash if a train has no router X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=HEAD;p=r2c2.git Don't crash if a train has no router --- 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),