hedgewars/uScript.pas
changeset 4456 b69f43f07cd7
parent 4453 15a483b2558a
child 4481 0d73e7db3d59
--- a/hedgewars/uScript.pas	Sat Dec 04 11:30:54 2010 -0500
+++ b/hedgewars/uScript.pas	Sat Dec 04 15:09:19 2010 -0500
@@ -263,7 +263,8 @@
         c:= lua_toboolean(L, 5);
 
         vg:= AddVisualGear(x, y, vgt, s, c); 
-        lua_pushnumber(L, vg^.uid)
+        if vg <> nil then lua_pushnumber(L, vg^.uid)
+        else lua_pushnumber(L, 0)
         end;
     lc_addvisualgear:= 1; // 1 return value
 end;