]> git.tdb.fi Git - r2c2.git/commitdiff
Don't crash if a train has no router master
authorMikko Rasa <tdb@tdb.fi>
Fri, 17 Apr 2015 23:46:23 +0000 (02:46 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 17 Apr 2015 23:46:23 +0000 (02:46 +0300)
source/libr2c2/trainrouteplanner.cpp

index 7aba4a68ed33e7ba0e3e434e655da77bd1dd02b9..0594b7ac635a81bb3a5691bbd77c58d53399c491 100644 (file)
@@ -249,6 +249,9 @@ TrainRoutePlanner::TrainRoutingInfo::TrainRoutingInfo(Train &t):
        router(train->get_ai_of_type<TrainRouter>()),
        has_duration(false)
 {
        router(train->get_ai_of_type<TrainRouter>()),
        has_duration(false)
 {
+       if(!router)
+               return;
+
        if(unsigned n_wps = router->get_n_waypoints())
        {
                waypoints.reserve(n_wps),
        if(unsigned n_wps = router->get_n_waypoints())
        {
                waypoints.reserve(n_wps),