From c47c0e34f77d4a5c164df5178ffa6b1d39279685 Mon Sep 17 00:00:00 2001
From: blackfisch <blackfisch@outlook.com>
Date: Tue, 2 Jun 2020 02:02:49 +0200
Subject: [PATCH 1/3] fix possible select outside array bounds

---
 Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf b/Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf
index 89bd1306d..49ea5c07a 100644
--- a/Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf
+++ b/Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf
@@ -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 (_textures isEqualTo [] || {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;

From 14ae93140c3b994b21d248cb5eef3c38de712515 Mon Sep 17 00:00:00 2001
From: blackfisch <blackfisch@outlook.com>
Date: Tue, 2 Jun 2020 02:04:44 +0200
Subject: [PATCH 2/3] simple check covers all cases

---
 Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf b/Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf
index 49ea5c07a..51c4f2c4f 100644
--- a/Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf
+++ b/Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf
@@ -28,7 +28,7 @@ if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _className)) then {
 };
 
 private _textures = M_CONFIG(getArray,"LifeCfgVehicles",_className,"textures");
-if (_textures isEqualTo [] || {count _textures <= _index}) exitWith {};
+if (count _textures <= _index) exitWith {};
 
 private _texturePaths =  (_textures select _index) param [2,[]]);
 

From a852a71ae32cae58ecb56b278182959cd03639e6 Mon Sep 17 00:00:00 2001
From: blackfisch <blackfisch@outlook.com>
Date: Tue, 2 Jun 2020 02:06:32 +0200
Subject: [PATCH 3/3] fix syntax

---
 Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf b/Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf
index 51c4f2c4f..53fd73777 100644
--- a/Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf
+++ b/Altis_Life.Altis/core/vehicle/fn_colorVehicle.sqf
@@ -30,7 +30,7 @@ if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _className)) then {
 private _textures = M_CONFIG(getArray,"LifeCfgVehicles",_className,"textures");
 if (count _textures <= _index) exitWith {};
 
-private _texturePaths =  (_textures select _index) param [2,[]]);
+private _texturePaths =  (_textures select _index) param [2,[]];
 
 _vehicle setVariable ["Life_VEH_color",_index,true];