Skip to content

Commit

Permalink
Common - Fix calling getVar on null object in canInteractWith (#8532)
Browse files Browse the repository at this point in the history
* Common - Fix calling getVar on null object in `canInteractWith`

* why was this added dedman?
  • Loading branch information
PabstMirror authored Oct 16, 2021
1 parent 2dfbaa9 commit a0e9f60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions addons/common/functions/fnc_canInteractWith.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ params ["_unit", "_target", ["_exceptions", []]];

_exceptions = _exceptions apply {toLower _x};

private _owner = _target getVariable [QGVAR(owner), objNull];

// exit if the target is not free to interact
if (!isNull _owner && {_unit != _owner}) exitWith {false};
if ((!isNull _target) && {
private _owner = _target getVariable [QGVAR(owner), objNull];
(!isNull _owner) && {_unit != _owner}}
) exitWith {false};

// check general conditions
private _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
Expand Down
4 changes: 3 additions & 1 deletion addons/movement/functions/fnc_handleVirtualMass.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ if (isNull _unit) exitWith {};
private _virtualLoad = 0;

{
_virtualLoad = _virtualLoad + (_x getVariable [QGVAR(vLoad), 0]);
if (!isNull _x) then {
_virtualLoad = _virtualLoad + (_x getVariable [QGVAR(vLoad), 0]);
};
} forEach [
_unit,
uniformContainer _unit,
Expand Down

0 comments on commit a0e9f60

Please sign in to comment.