Skip to content

Commit

Permalink
nil checks for get unit type
Browse files Browse the repository at this point in the history
  • Loading branch information
theace0296 committed Dec 30, 2021
1 parent 8e0ee93 commit feee2cb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion RandFramework/Global/common/fn_getUnitType.sqf
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
// private _fnc_scriptName = "TRGM_GLOBAL_fnc_getUnitType";
params [["_type", "", [""]]];

private _returnType = "riflemen";
if (isNil "_type" || { _type isEqualTo ""}) exitWith {_returnType;};

private _configPath = (configFile >> "CfgVehicles" >> _type);
if (isNil "_configPath") exitWith {_returnType;};

private _unitData = [_configPath] call TRGM_GLOBAL_fnc_getUnitData;
if (isNil "_unitData" || {!(_unitData isEqualType [])}) exitWith {_returnType;};

_unitData params ["_className", "_dispName", "_rawDispName", "_icon", "_calloutName", "_isMedic", "_isEngineer", "_isExpSpecialist", "_isUAVHacker", "_role"];

private _returnType = "riflemen";
if (isNil "_className" || isNil "_dispName" || isNil "_rawDispName" || isNil "_icon" || isNil "_calloutName" || [_configPath] call TRGM_GLOBAL_fnc_ignoreUnit) then {
_returnType = "riflemen";
} else {
Expand Down

0 comments on commit feee2cb

Please sign in to comment.