diff -r a0c8779713f2 -r b69f43f07cd7 hedgewars/uScript.pas --- 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;