merge to trunk
authornemo
Fri, 20 Jan 2023 21:40:37 -0500
changeset 15938 4c0f8dbf6c13
parent 15928 73cdc306888f (current diff)
parent 15937 1becf4a0e907 (diff)
child 15939 9cdc61bc6535
merge to trunk
hedgewars/uGearsHandlersMess.pas
hedgewars/uScript.pas
--- a/hedgewars/uGearsHandlersMess.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uGearsHandlersMess.pas	Fri Jan 20 21:40:37 2023 -0500
@@ -264,6 +264,7 @@
 
 procedure HideHog(HH: PHedgehog);
 begin
+    if HH^.Gear = nil then exit;
     ScriptCall('onHogHide', HH^.Gear^.Uid);
     DeleteCI(HH^.Gear);
     if FollowGear = HH^.Gear then
--- a/hedgewars/uScript.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uScript.pas	Fri Jan 20 21:40:37 2023 -0500
@@ -3225,7 +3225,7 @@
     if CheckLuaParamCount(L, 1, 'HideHog', 'gearUid') then
         begin
         gear:= GearByUID(Trunc(lua_tonumber(L, 1)));
-        if (gear <> nil) and (gear^.hedgehog <> nil) then
+        if (gear <> nil) and (gear^.hedgehog <> nil) and (gear^.hedgehog^.gear <> nil) then
             begin
             HideHog(gear^.hedgehog);
             lua_pushboolean(L, true);