Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBA_fnc_compatibleItems throws undefined variable errors when called with a single parameter #1653

Closed
jaj22 opened this issue Apr 2, 2024 · 1 comment · Fixed by #1655
Closed
Labels
Milestone

Comments

@jaj22
Copy link

jaj22 commented Apr 2, 2024

Mods (complete and add to the following information):

  • Arma 3: 2.16 stable
  • CBA: 3.17 release, whatever that is

Description:
CBA_fnc_compatibleItems throws an undefined variable error when called with a single parameter in scheduled execution, eg:

0 spawn {
  ["arifle_MX_F"] call CBA_fnc_compatibleItems;
};

Results in:

19:37:53 Error in expression <key = format ["%1#%2", _weapon, ["all", _typefilter] select _typeFilterExists];>
19:37:53   Error position: <_typefilter] select _typeFilterExists];>
19:37:53   Error Undefined variable in expression: _typefilter
19:37:53 File /x/cba/addons/jr/fnc_compatibleItems.sqf..., line 267

The select is invalid in scheduled mode because _typefilter is dereferenced regardless of the value of _typeFilterExists.

This breaks several routines in Antistasi because the function also replaces BIS_fnc_compatibleItems.

@jaj22 jaj22 added the Bug label Apr 2, 2024
@jonpas
Copy link
Member

jonpas commented Apr 3, 2024

Source: 3136ba8#diff-f14f3d8b855006380dea022443bdffa109bb35054f833cc036d1ac7f67d46e1b

_typefilter is by default nil, and previously if-then only evaluated it if _typeFilterExists == true. With select both expressions in array are resolved either way, causing this error.

This should be written better to begin with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants