diff --git a/addons/common/fnc_removePerFrameHandler.sqf b/addons/common/fnc_removePerFrameHandler.sqf index ab82c91cf..23a9f1d66 100644 --- a/addons/common/fnc_removePerFrameHandler.sqf +++ b/addons/common/fnc_removePerFrameHandler.sqf @@ -25,8 +25,12 @@ Author: #include "script_component.hpp" params ["_publicHandle"]; + +if (isNil "_publicHandle" || {(_publicHandle < 0)} || {!((count GVAR(PFHhandles)) >= _publicHandle)}) exitWith { // Nil/no handle, nil action or handle is larger than Public Handle Array + WARNING("Invalid or not existing PFH ID."); +}; + private "_handle"; -if (isNil "_publicHandle" || (_publicHandle < 0)) exitWith {}; // Nil/no handle, nil action _handle = GVAR(PFHhandles) select _publicHandle; if (isNil "_handle") exitWith {}; // Nil handle, nil action GVAR(PFHhandles) set [_publicHandle, nil]; diff --git a/addons/common/init_perFrameHandler.sqf b/addons/common/init_perFrameHandler.sqf index 7ba261c18..94c41d126 100644 --- a/addons/common/init_perFrameHandler.sqf +++ b/addons/common/init_perFrameHandler.sqf @@ -136,13 +136,15 @@ FUNC(onFrame) = { // GVAR(fpsCount) = GVAR(fpsCount) + 1; // player sideChat format["c: %1", GVAR(perFrameHandlerArray)]; { + if !(isNil "_x") then { - if (_x params ["_func", "_delay", "_delta", "", "_args", "_idPFH"]) then { + _handlerData = _x; + if (_handlerData params ["_func", "_delay", "_delta", "", "_args", "_idPFH"]) then { if (diag_tickTime > _delta) then { [_args, _idPFH] call _func; _delta = diag_tickTime + _delay; //TRACE_1("data", _data); - _x set [2, _delta]; + _handlerData set [2, _delta]; }; }; };