diff --git a/addons/rearm/functions/fnc_dropAmmo.sqf b/addons/rearm/functions/fnc_dropAmmo.sqf index 48433c2f4a..eafc8bee50 100644 --- a/addons/rearm/functions/fnc_dropAmmo.sqf +++ b/addons/rearm/functions/fnc_dropAmmo.sqf @@ -20,6 +20,8 @@ private ["_dummy", "_actionID"]; params [["_unit", objNull, [objNull]], ["_delete", false, [false]], ["_unholster", true, [true]]]; +if (isNull _unit) exitWith {}; + _dummy = _unit getVariable [QGVAR(dummy), objNull]; if !(isNull _dummy) then { detach _dummy; diff --git a/addons/rearm/script_component.hpp b/addons/rearm/script_component.hpp index 4ed152c6b5..700ca40f23 100644 --- a/addons/rearm/script_component.hpp +++ b/addons/rearm/script_component.hpp @@ -33,5 +33,8 @@ #define REARM_UNHOLSTER_WEAPON \ _weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRearm); \ - _unit selectWeapon _weaponSelect; \ - _unit setVariable [QGVAR(selectedWeaponOnRearm), nil]; + TRACE_2("REARM_UNHOLSTER_WEAPON",_unit,_weaponSelect); \ + if (!isNil "_weaponSelect") then { \ + _unit selectWeapon _weaponSelect; \ + _unit setVariable [QGVAR(selectedWeaponOnRearm), nil]; \ + }; \