Refuel - Fix infinite recursion for getCapacity on a non-CfgVehicle (#9622)

* Refuel - Fix infinite recursion for `getCapacity` checking a non-CfgVehicle

Close #9620

* Update addons/refuel/functions/fnc_getCapacity.sqf
This commit is contained in:
PabstMirror 2023-11-04 15:58:17 -05:00 committed by GitHub
parent 30ec1eda16
commit 2c5ef6a6ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,6 +29,8 @@ if (isNil "_capacity") then {
// Set capacity even if this isn't a fuel source to save on config lookup time in the event this function is used in a loop
_source setVariable [QGVAR(capacity), _capacity, true];
// handle weird edge case when trying to run on "camera"/CfgNonAIVehicles which won't support setVariable and will inf-loop
if (isNil {_source getVariable QGVAR(capacity)}) exitWith { WARNING_1("trying to getCapacity from non-CfgVehicle %1", _this); };
[_source, _capacity] call FUNC(setFuel);
};