From 6ac4610e9a94f7415b8f01a653242b570057a02b Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 14 Nov 2010 16:39:33 +0000 Subject: [PATCH] Fix a segfault in removing vehicles when creating a new train --- source/engineer/trainproperties.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/engineer/trainproperties.cpp b/source/engineer/trainproperties.cpp index e574925..eaddc8b 100644 --- a/source/engineer/trainproperties.cpp +++ b/source/engineer/trainproperties.cpp @@ -151,7 +151,7 @@ void TrainProperties::remove_vehicle_clicked() lst_vehicles->remove(selected); - unsigned n_vehicles = train->get_n_vehicles()-rem_vehicles.size(); + unsigned n_vehicles = (train ? train->get_n_vehicles()-rem_vehicles.size() : 0); if(static_cast(selected)>=n_vehicles) add_vehicles.erase(add_vehicles.begin()+(selected-n_vehicles)); else -- 2.45.2