Luna Unit Frames - Classic Fix

Luna Unit Frames - Classic Fix

26.7k Downloads

LUA errors with CompactRaidFRameManager

farske opened this issue ยท 2 comments

commented

Hey!

I keep getting LUA errors, many many of them about the CompactRaidFrameManager based off LunaUnitFrames doing seomthing.

Can you see if its a bug or help me nail down the issue?

BUGSACK:
768x LunaUnitFrames/LunaUnitFrames.lua:447: attempt to index field 'hidden' (a nil value)
[string "@LunaUnitFrames/LunaUnitFrames.lua"]:447: in function <LunaUnitFrames/LunaUnitFrames.lua:446>
[string "=[C]"]: in function CompactRaidFrameManager_UpdateShown' [string "@FrameXML/SettingDefinitions/InterfaceOverrides.lua"]:291: in function <...e/FrameXML/SettingDefinitions/InterfaceOverrides.lua:288> [string "=[C]"]: ? [string "@SharedXML/CallbackRegistry.lua"]:178: in function <SharedXML/CallbackRegistry.lua:177> [string "=[C]"]: ? [string "@SharedXML/CallbackRegistry.lua"]:181: in function TriggerEvent'
[string "@SharedXML/CvarUtil.lua"]:114: in function <SharedXML/CvarUtil.lua:106>

Locals:
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index field 'hidden' (a nil value)"
hideRaid = defined @LunaUnitFrames/LunaUnitFrames.lua:434

commented

I looked into it and the issue is from the values set in the "Hide Blizzard" tab of the options. The values LUF.db.profile.hidden are always set to a default

The offending code can only run if the values existed and then got deleted somehow. I can't see any places in the Luna code that would do it. So it might be another addon or something I can't find.

if( CompactRaidFrameManager ) then
	--VALUE EXISTS HERE
	if( LUF.db.profile.hidden.raid and not active_hiddens.raid ) then
		active_hiddens.raid = true
		local function hideRaid()
			CompactRaidFrameManager:UnregisterAllEvents()
			CompactRaidFrameContainer:UnregisterAllEvents()
			if( InCombatLockdown() ) then return end

			CompactRaidFrameManager:Hide()
			local shown = CompactRaidFrameManager_GetSetting("IsShown")
			if( shown and shown ~= "0" ) then
				CompactRaidFrameManager_SetSetting("IsShown", "0")
			end
		end
		
		hooksecurefunc("CompactRaidFrameManager_UpdateShown", function()
			--VALUE DOESNT EXIST AND ERRORS HERE			
			if( LUF.db.profile.hidden.raid ) then	
				hideRaid()
			end
		end)
		
		hideRaid()
		CompactRaidFrameContainer:HookScript("OnShow", hideRaid)
		CompactRaidFrameManager:HookScript("OnShow", hideRaid)
	end
end
commented

I added a check for when this part of your settings are corrupt and set them to default which should fix this in https://github.com/caboyd/LunaUI-ClassicFix/releases/tag/4378