diff --git a/addons/arsenal/XEH_postInit.sqf b/addons/arsenal/XEH_postInit.sqf index ac6283e6044..33646a25d74 100644 --- a/addons/arsenal/XEH_postInit.sqf +++ b/addons/arsenal/XEH_postInit.sqf @@ -22,7 +22,8 @@ GVAR(lastSortDirectionRight) = DESCENDING; params ["_object"]; // If the arsenal is already open, refresh arsenal display - if (!isNil QGVAR(currentBox) && {GVAR(currentBox) isEqualTo _object}) then { + // Deliberate == check, fail on objNull + if (!isNil QGVAR(currentBox) && {GVAR(currentBox) == _object}) then { [true, true] call FUNC(refresh); }; }] call CBA_fnc_addEventHandler; diff --git a/addons/arsenal/functions/fnc_refresh.sqf b/addons/arsenal/functions/fnc_refresh.sqf index d40d59c0ff6..849b49d16b1 100644 --- a/addons/arsenal/functions/fnc_refresh.sqf +++ b/addons/arsenal/functions/fnc_refresh.sqf @@ -25,6 +25,11 @@ if (canSuspend) exitWith { [{_this call FUNC(refresh)}, _this] call CBA_fnc_directCall; }; +private _display = findDisplay IDD_ace_arsenal; + +// Exit quietly if no display found +if (isNull _display) exitWith {}; + if (_updateItems) then { // Update current item list call FUNC(updateCurrentItemsList); @@ -65,6 +70,4 @@ if (!_animate) then { [{GVAR(refreshing) = false}, nil, 3] call CBA_fnc_execAfterNFrames; }; -private _display = findDisplay IDD_ace_arsenal; - [_display, _display displayCtrl GVAR(currentLeftPanel), _animate] call FUNC(fillLeftPanel); diff --git a/addons/arsenal/functions/fnc_removeBox.sqf b/addons/arsenal/functions/fnc_removeBox.sqf index 984db8d0998..9fa3ec377a2 100644 --- a/addons/arsenal/functions/fnc_removeBox.sqf +++ b/addons/arsenal/functions/fnc_removeBox.sqf @@ -42,8 +42,14 @@ if (_global && {isMultiplayer} && {!isNil "_id"}) then { }; // If the arsenal is already open and not ignoring content (see FUNC(openBox)), close arsenal display -if (!isNil QGVAR(currentBox) && {GVAR(currentBox) isEqualTo _object} && {isNil QGVAR(ignoredVirtualItems)}) then { - [LLSTRING(noVirtualItems), false, 5, 1] call EFUNC(common,displayText); - // Delay a frame in case this is running on display open - [{(findDisplay IDD_ace_arsenal) closeDisplay 0}] call CBA_fnc_execNextFrame; +// Deliberate == check, fail on objNull +if (!isNil QGVAR(currentBox) && {GVAR(currentBox) == _object} && {isNil QGVAR(ignoredVirtualItems)}) then { + // Delay a frame in case this is running on display open/close + [{ + private _display = findDisplay IDD_ace_arsenal; + if (isNull _display) exitWith {}; + + [LLSTRING(noVirtualItems), false, 5, 1] call EFUNC(common,displayText); + _display closeDisplay 0; + }] call CBA_fnc_execNextFrame; };