summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-18 17:40:03 +0000
committersmatz <smatz@openttd.org>2009-05-18 17:40:03 +0000
commita0ff6363e6429fded7bd39adacd14a191ef00526 (patch)
treebc7bba0fa23bac1a9ce8dd4835cd8806d167fbb6
parent8808f3beea881af5652716c883a21c8031b5e390 (diff)
downloadopenttd-a0ff6363e6429fded7bd39adacd14a191ef00526.tar.xz
(svn r16353) -Fix (r1): invalid read when OTTD savegame contains VEH_INVALID
-rw-r--r--src/saveload/oldloader_sl.cpp2
-rw-r--r--src/saveload/vehicle_sl.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index a0764d408..fc2d2038c 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -1260,7 +1260,7 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
uint type = ReadByte(ls);
switch (type) {
default: return false;
- case 0x00 /* VEH_INVALID */: v = new (_current_vehicle_id) InvalidVehicle(); break;
+ case 0x00 /* VEH_INVALID */: v = new (_current_vehicle_id) InvalidVehicle(); break;
case 0x25 /* MONORAIL */:
case 0x20 /* VEH_TRAIN */: v = new (_current_vehicle_id) Train(); break;
case 0x21 /* VEH_ROAD */: v = new (_current_vehicle_id) RoadVehicle(); break;
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index 3d498851c..ae904dbd5 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -698,7 +698,7 @@ void Load_VEHS()
case VEH_AIRCRAFT: v = new (index) Aircraft(); break;
case VEH_EFFECT: v = new (index) EffectVehicle(); break;
case VEH_DISASTER: v = new (index) DisasterVehicle(); break;
- case VEH_INVALID: v = new (index) InvalidVehicle(); break;
+ case VEH_INVALID: /* Savegame shouldn't contain invalid vehicles */
default: NOT_REACHED();
}