ALiVEOS / ALiVE.OS

ALiVE Open Source GPL v2
http://alivemod.com/
Other
160 stars 80 forks source link

Function ALiVE_fnc_HashGet causes an Undefined variable error in function ALiVE_fnc_ProfileNameSpaceLoad #791

Open scameronde opened 1 year ago

scameronde commented 1 year ago

Prerequisites

Description

In certain conditions, the function ALiVE_fnc_ProfileNameSpaceLoad throws an error and returns an isNil value.

Steps to Reproduce

  1. start a new scenario with local data persistence (so basically isNil (profileNamespace getVariable _mission))
  2. call "my_var" call ALiVE_fnc_ProfileNameSpaceLoad -> returns false
  3. server save scenario
  4. call "my_var" call ALiVE_fnc_ProfileNameSpaceLoad -> ALiVE_fnc_HashGet throws an error
  5. call ["my_var", true] call ALiVE_fnc_ProfileNameSpaceSave then call "my_var" call ALiVE_fnc_ProfileNameSpaceLoad -> returns true

Expected behavior: [What you expected to happen]

Step 4 should not throw an error. It might be OK to return false like in step 2 (the case with no initialized profile data)

Actual behavior: [What actually happened]

Step 4 throws an error and the function ALiVE_fnc_ProfileNameSpaceLoad, which it should not.

scameronde commented 1 year ago

Can not attach rpt. Here are the log lines showing the error:

11:44:39 [CBA] (xeh) INFO: [378000,6632.26,0] PostInit started. MISSIONINIT: missionName=ALiVE-Operation-Landlord-V2, missionVersion=54, worldName=Altis, isMultiplayer=true, isServer=true, isDedicated=false, CBA_isHeadlessClient=false, hasInterface=true, didJIP=false
11:44:39 [CBA] (versioning) INFO: [378000,6632.28,0] VERSIONING:alive_main=1.17.0.2209061, cba=3.15.8.220912, zen=1.12.2.30, cfp=0.6.8.19101500
11:44:39 [CBA] (xeh) INFO: [378000,6632.46,0] PostInit finished.
11:44:40 ALiVE 0 : 6633.19 - ALiVE_sys_acemenu: ACE interact_menu not active or no interface found, exiting
11:44:40 ALiVE 0 : 6633.32 - Registered controls for NON-JIP on briefing screen: B Alpha 1-2:1 (scameronde)
11:44:40 ALiVE 0 : 6633.32 - Registered SITREP controls for NON-JIP on briefing screen: B Alpha 1-2:1 (scameronde)
11:44:40 ALiVE 0 : 6633.32 - Registered PATROLREP controls for NON-JIP on briefing screen: B Alpha 1-2:1 (scameronde)
11:44:40 Error in expression < {[_data,_id] call ALiVE_fnc_HashGet};

_result>
11:44:40   Error position: <_result>
11:44:40   Error Undefined variable in expression: _result
11:44:40 File x\alive\addons\x_lib\functions\data\fnc_ProfileNameSpaceLoad.sqf..., line 38