From bdb73b1fd5ddd1899adae528ec64b3077b918a61 Mon Sep 17 00:00:00 2001 From: x3Karma Date: Fri, 1 Dec 2023 08:14:41 +0800 Subject: Fix crash when calling for invalid loadout index (#764) Requesting for invalid loadout index using SwapSecondaryAndWeapon3PersistentLoadoutData will cause a crash. This change just adds a check to reset the loadout index. --- Northstar.CustomServers/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 76cb4ac4..63756fdc 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) ) + return false + PilotLoadoutDef loadout = GetPilotLoadoutFromPersistentData( player, index ) // swap loadouts -- cgit v1.2.3