Skip to content

Commit

Permalink
Joint Rails - Fix _typefilter undefined variable error (#1612)
Browse files Browse the repository at this point in the history
Co-authored-by: PabstMirror <[email protected]>
  • Loading branch information
johnb432 and PabstMirror authored Oct 2, 2023
1 parent 610c804 commit 9686974
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions addons/jr/fnc_compatibleItems.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ if !(isClass _weaponConfig) exitWith {
[]
};

private _typeFilterExists = !isNil "_typefilter";

// Convert filter into number (if string)
if (_typefilter isEqualType "") then {
if (_typeFilterExists && {_typefilter isEqualType ""}) then {
_typefilter = [-1, 101, 201, 301, 302] param [["", "muzzle", "optic", "pointer", "bipod"] find _typefilter, -1];
};

private _typeFilterExists = !isNil "_typefilter";

// Check if valid type filter
if (_typeFilterExists && {!(_typefilter in [101, 201, 301, 302])}) exitWith {[]};

Expand All @@ -52,7 +52,7 @@ if (isNil QGVAR(namespace)) then {
};

// Get cached result, if it exists
private _cachekey = format ["%1#%2", _weapon, ["all", _typefilter] select _typeFilterExists];
private _cachekey = format ["%1#%2", _weapon, if (_typeFilterExists) then {_typefilter} else {"all"} ];
private _compatibleItems = GVAR(namespace) get _cachekey;

if (!isNil "_compatibleItems") exitWith {
Expand Down

0 comments on commit 9686974

Please sign in to comment.