]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/trainrouteplanner.cpp
Don't crash if a train has no router
[r2c2.git] / 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)
 {
+       if(!router)
+               return;
+
        if(unsigned n_wps = router->get_n_waypoints())
        {
                waypoints.reserve(n_wps),