Benik / BenikUI

BenikUI is an external ElvUI mod, adding different frame style and new features like detatched portraits and dashboards.
https://www.curseforge.com/wow/addons/benikui
7 stars 6 forks source link

Dashboard error causing lag / ElvUI addon settings disappear #57

Closed radumalica closed 2 months ago

radumalica commented 2 months ago

Describe the bug and post the error message, if there is one After intallation of 4.52, i have this error

To Reproduce Steps to reproduce the behavior: Install Elvui latest version and BenikUI, you will get an error catched by BugSack

Expected behavior A clear and concise description of what you expected to happen. No error should appear, and ElvUI addon settings should be visible

Screenshots If applicable, add screenshots to help explain your problem.

Please include the addon and game versions:

Additional context Add any other context about the problem here.

Here is the error:

8x ...dOns/ElvUI_BenikUI/modules/dashboard/reputations.lua:293: attempt to index local 'info' (a nil value) [string "@ElvUI_BenikUI/modules/dashboard/reputations.lua"]:293: in function 'PopulateFactionData' [string "@ElvUI_BenikUI/modules/dashboard/reputations.lua"]:377: in function 'ToggleReputations' [string "@ElvUI_BenikUI/modules/dashboard/reputations.lua"]:401: in function 'CreateReputationsDashboard' [string "@ElvUI_BenikUI/modules/dashboard/reputations.lua"]:405: in function 'LoadReputations' [string "@ElvUI_BenikUI/modules/dashboard/dashboards.lua"]:299: in function 'Initialize'

After digging a little bit, it seems that for TWW, Blizzard doesn't return the factions on GetFactionDataByIndex, hence info having a nil value.

What i did to fix the problem was adding another if statement in function mod:PopulateFactionData() which checks if info is nil or not

here is the workaround which fixes the problem adding another line after local info = GetFactionData(factionIndex):

while (factionIndex <= numFactions) do
    local info = GetFactionInfo(factionIndex)

    if info then
        if info.isHeader and info.isCollapsed then
            ExpandFactionHeader(factionIndex)
            numFactions = GetNumFactions()
            Collapsed[info.name] = true
        end

        if info.isHeader and not (info.hasRep or info.isChild) then
            tinsert(mod.ReputationsList, { info.name, info.factionID, factionIndex, info.isHeader, info.hasRep, info.isChild })
            headerIndex = factionIndex
        end

        if not info.isHeader or not info.isChild or info.hasRep then
            if info.factionID then
                mod.ReputationsList[tostring(info.factionID)] = info.name
                tinsert(mod.ReputationsList, { info.name, info.factionID, headerIndex, info.isHeader, info.hasRep, info.isChild })
            end
        end
    else
        -- Debugging output to track the problematic factionIndex
        print("Warning: GetFactionInfo returned nil for factionIndex " .. factionIndex)
    end
Benik commented 2 months ago

I had an "info" check at the dev version but didn't do much. I will implement your solution, although the whole module breaks when Blizzard Reputation pane breaks. Will see. Thank you :)

radumalica commented 2 months ago

Glad i could help, I see that you released v4.53 with the fix so I will close this issue.