diff src/roadveh_cmd.cpp @ 7768:529cd49be451 draft

(svn r11317) -Fix [FS#1355]: don't read a variable of a destroyed vehicle as the value will be reset to 0.
author rubidium <rubidium@openttd.org>
date Sat, 20 Oct 2007 20:15:34 +0000 (2007-10-20)
parents 3d5b53da1837
children f81103463949
line wrap: on
line diff
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -367,6 +367,8 @@
 		return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
 	}
 
+	CommandCost ret(-v->value);
+
 	if (flags & DC_EXEC) {
 		// Invalidate depot
 		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
@@ -377,7 +379,7 @@
 		delete v;
 	}
 
-	return CommandCost(-v->value);
+	return ret;
 }
 
 struct RoadFindDepotData {