Skip to content

Commit

Permalink
Medical - Fix out of scope var (#10734)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkIsGrim authored Feb 9, 2025
1 parent 1fb128b commit ec817f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addons/medical_damage/functions/fnc_getTypeOfDamage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ params ["_typeOfProjectile"];

GVAR(damageTypeCache) getOrDefaultCall [_typeOfProjectile, {
private _projectileConfig = configFile >> "CfgAmmo" >> _typeOfProjectile >> "ACE_damageType";
private _damageType = ""; // needs to be higher scope because switch

switch (false) do {
case (isText _projectileConfig): { // no property or wrong type
WARNING_1("Ammo type [%1] has no ACE_damageType",_typeOfProjectile);
"unknown" // return
};

private _damageType = getText _projectileConfig;
_damageType = getText _projectileConfig;
case (_damageType in GVAR(damageTypeDetails)): { // config may define an invalid damage type
WARNING_2("Damage type [%1] for ammo [%2] not found",_damageType,_typeOfProjectile);
"unknown" // return
Expand Down

0 comments on commit ec817f7

Please sign in to comment.