changeset 15540:f47ab35641c8 draft

(svn r20199) -Fix [FS#3964]: NewGRFs that defined a vehicle without either loaded or loading groups could crash OpenTTD
author yexo <yexo@openttd.org>
date Wed, 21 Jul 2010 11:29:59 +0000
parents 5641cbda73c0
children e66be28ee89e
files src/newgrf_engine.cpp
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -841,6 +841,8 @@
 
 	uint totalsets = in_motion ? group->num_loaded : group->num_loading;
 
+	if (totalsets == 0) return NULL;
+
 	uint set = (v->cargo.Count() * totalsets) / max((uint16)1, v->cargo_cap);
 	set = min(set, totalsets - 1);