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

fix possible select outside array bounds #699

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _className)) then {
_className = "Default"; //Use Default class if it doesn't exist
};

private _textures = ((M_CONFIG(getArray,"LifeCfgVehicles",_className,"textures") select _index) param [2,[]]);
if (_textures isEqualTo []) exitWith {};
private _textures = M_CONFIG(getArray,"LifeCfgVehicles",_className,"textures");
if (count _textures <= _index) exitWith {};

private _texturePaths = (_textures select _index) param [2,[]];

_vehicle setVariable ["Life_VEH_color",_index,true];

{_vehicle setObjectTextureGlobal [_forEachIndex,_x]} forEach _textures;
{_vehicle setObjectTextureGlobal [_forEachIndex,_x]} forEach _texturePaths;