From fc9ba7ac270b2dcfc5c5ba75e211d88f163c714a Mon Sep 17 00:00:00 2001 From: parnic Date: Sun, 25 Aug 2024 22:44:14 -0500 Subject: [PATCH] Fix reported TooltipScanning error from reputation (#16) I'm not sure why an index that's within range of GetNumFactions would return nil data from GetFactionDataByIndex, so we probably need to figure out what's up with that. Maybe the value returned by GetNumFactions is only a valid input in some other GetFactionDataBy variant? Ref: * https://www.wowace.com/projects/ice-hud/issues/366 * https://www.curseforge.com/projects/5394?comment=7333 --- Categories/Reputation.lua | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Categories/Reputation.lua b/Categories/Reputation.lua index d7afc9d..e40332c 100644 --- a/Categories/Reputation.lua +++ b/Categories/Reputation.lua @@ -28,20 +28,22 @@ if C_Reputation and C_Reputation.GetNumFactions then local function iter() for i = 1, GetNumFactions() do local data = GetFactionDataByIndex(i) - if data.isHeader == 1 then - if data.isCollapsed == 1 then - local NumFactions = GetNumFactions() - ExpandFactionHeader(i) - currentOpenHeader = i - NumFactions = GetNumFactions() - NumFactions - for j = i+1, i+NumFactions do - yield(GetFactionInfo(j)) + if data then + if data.isHeader == 1 then + if data.isCollapsed == 1 then + local NumFactions = GetNumFactions() + ExpandFactionHeader(i) + currentOpenHeader = i + NumFactions = GetNumFactions() - NumFactions + for j = i+1, i+NumFactions do + yield(GetFactionInfo(j)) + end + CollapseFactionHeader(i) + currentOpenHeader = nil end - CollapseFactionHeader(i) - currentOpenHeader = nil + else + yield(data.name, data.description, data.reaction, data.currentReactionThreshold, data.nextReactionThreshold, data.currentStanding) end - else - yield(data.name, data.description, data.reaction, data.currentReactionThreshold, data.nextReactionThreshold, data.currentStanding) end end end