summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-10-16 19:27:24 +0000
committerrubidium <rubidium@openttd.org>2007-10-16 19:27:24 +0000
commit4f512a70c360e2aa45e80aacdbcc95d2a754b987 (patch)
treebfefaf16803d67ac87f3a781c30622a53a30de4f
parentebfc4b2842085eaf79d6eb46f83945f0e0f6886c (diff)
downloadopenttd-4f512a70c360e2aa45e80aacdbcc95d2a754b987.tar.xz
(svn r11275) -Fix: oldloader crashing when referencing a vehicle that is not yet loaded.
-rw-r--r--src/oldloader.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/oldloader.cpp b/src/oldloader.cpp
index 0f39e2600..f3d394bd1 100644
--- a/src/oldloader.cpp
+++ b/src/oldloader.cpp
@@ -1231,7 +1231,7 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
default: v->spritenum >>= 1; break;
}
- if (_old_next_ptr != 0xFFFF) v->next = GetVehicle(_old_next_ptr);
+ if (_old_next_ptr != 0xFFFF) v->next = GetVehiclePoolSize() <= _old_next_ptr ? new (_old_next_ptr) InvalidVehicle() : GetVehicle(_old_next_ptr);
v->string_id = RemapOldStringID(_old_string_id);