hedgewars/uScript.pas
changeset 11196 f4cf2cdea8e5
parent 11179 98d14636c371
child 11251 66796cd627d8
--- a/hedgewars/uScript.pas	Fri Sep 25 23:31:16 2015 -0400
+++ b/hedgewars/uScript.pas	Sat Oct 03 17:02:57 2015 -0400
@@ -628,7 +628,9 @@
         begin
         gear := SpawnFakeCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2),
         HealthCrate, lua_toboolean(L, 3), lua_toboolean(L, 4));
-        lua_pushinteger(L, gear^.uid);
+        if gear <> nil then
+             lua_pushinteger(L, gear^.uid)
+        else lua_pushnil(L)
         end
     else
         lua_pushnil(L);