From 9e65b6c5bf2413245c65dda75b84579f06323011 Mon Sep 17 00:00:00 2001 From: x3Karma Date: Thu, 30 Nov 2023 08:03:36 +0800 Subject: [PATCH 1/2] Fixed crash when calling for invalid loadout index --- .../mod/scripts/vscripts/_loadouts_mp.gnut | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut index 76cb4ac44..961a39936 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut @@ -193,6 +193,10 @@ bool function ClientCommandCallback_SwapSecondaryAndWeapon3PersistentLoadoutData // get loadout int index = args[0].tointeger() + + if ( !IsValidPilotLoadoutIndex(index) ) + index = 0 + PilotLoadoutDef loadout = GetPilotLoadoutFromPersistentData( player, index ) // swap loadouts From 0c418b2ff222d0abcf4808eee4081d46df2061d8 Mon Sep 17 00:00:00 2001 From: x3Karma Date: Thu, 30 Nov 2023 08:14:26 +0800 Subject: [PATCH 2/2] Change to return false instead of resetting loadouts --- Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut index 961a39936..63756fdc8 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut @@ -195,7 +195,7 @@ bool function ClientCommandCallback_SwapSecondaryAndWeapon3PersistentLoadoutData int index = args[0].tointeger() if ( !IsValidPilotLoadoutIndex(index) ) - index = 0 + return false PilotLoadoutDef loadout = GetPilotLoadoutFromPersistentData( player, index )