From 69d778d6d6bf802571848f317fc082512eb26311 Mon Sep 17 00:00:00 2001 From: roby-brok Date: Mon, 10 Aug 2026 07:00:47 +0100 Subject: [PATCH] Fix two dangling skin includes and four error paths (#39) * skins: drop includes for two files that were never committed init/skins.xml referenced custom_merchant.lua and arena_score.lua, neither of which is tracked in git. Every install -- release zips included, since the release workflow packages the repo -- throws two 'Error loading' lines at login and ships without those two skins. (cherry picked from commit b338b4a16d0def4ae89fde5c6026e58a796b8c00) * map: don't re-anchor the world map to the frame GetPoint returned Ctrl+scroll rescales the map and repositions it to keep the top-left fixed, but it re-anchored using the relative frame GetPoint handed back. Once anything else is anchored to WorldMapFrame that throws WorldMapFrame:SetPoint(): is dependent on this and the error aborts the rest of the zoom handler, so SetScale never runs. Anchor to the parent instead. That is what the rest of pfUI's movable system already assumes -- LoadMovable uses the 3-arg form and SaveMovable stores only xpos/ypos with no relative frame. (cherry picked from commit bf055d87fc0a04ac912c13fa874a4331f47bdfa8) * firstrun: return after bailing on a disabled chat module All three chat setup steps printed 'Chat module is disabled' and then carried on into the nil pfUI.chat they had just tested for. (cherry picked from commit 1af427e3b38bb7c13f645ae7a48b8ade3e7455a9) * unitxp: stop the free-frame distance poller on logout The PLAYER_LOGOUT handler stops the indicators to avoid the UnitXP crash on exit, but in free-frame distance mode the polling runs on a separate scanner frame that was never exposed, so the handler could not reach it and its OnUpdate kept calling into UnitXP during teardown. Exposes the frame as pfUI.uf.target.distanceScanner and stops it alongside the others. * roll: bail out on an item the client has not cached C_Item.GetItemInfo returns nil for an item that is not cached yet, and the next line assigns pfUI.roll.cache[itemName], which throws "table index is nil" on a nil key. Easy to hit on a fresh login when someone rolls on an item you have never seen. * cooldown: return after hiding on a nil parent Without the return it falls straight through to parent:GetName() on the nil it just tested for. --- init/skins.xml | 2 -- modules/cooldown.lua | 2 +- modules/firstrun.lua | 6 +++--- modules/map.lua | 8 +++++++- modules/roll.lua | 1 + modules/unitxp.lua | 7 +++++++ 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/init/skins.xml b/init/skins.xml index 21685372..1e8d04d0 100644 --- a/init/skins.xml +++ b/init/skins.xml @@ -41,8 +41,6 @@ - - diff --git a/modules/cooldown.lua b/modules/cooldown.lua index 62af1b5f..6c249e44 100644 --- a/modules/cooldown.lua +++ b/modules/cooldown.lua @@ -9,7 +9,7 @@ pfUI:RegisterModule("cooldown", function () local parent, parent_name local function pfCooldownOnUpdate() parent = this:GetParent() - if not parent then this:Hide() end + if not parent then this:Hide() return end parent_name = parent:GetName() -- avoid to set cooldowns on invalid frames diff --git a/modules/firstrun.lua b/modules/firstrun.lua index 5e55c12d..af0c0965 100644 --- a/modules/firstrun.lua +++ b/modules/firstrun.lua @@ -263,7 +263,7 @@ pfUI:RegisterModule("firstrun", function () SkinCheckbox(f.checkbox, 18) f.NextScript = function() - if not pfUI.chat then message("Couldn't apply settings. Chat module is disabled.") end + if not pfUI.chat then message("Couldn't apply settings. Chat module is disabled.") return end pfUI.chat.SetupRightChat(f.checkbox:GetChecked()) end @@ -283,7 +283,7 @@ pfUI:RegisterModule("firstrun", function () SkinCheckbox(f.checkbox, 18) f.NextScript = function() - if not pfUI.chat then message("Couldn't apply settings. Chat module is disabled.") end + if not pfUI.chat then message("Couldn't apply settings. Chat module is disabled.") return end if f.checkbox:GetChecked() then pfUI.chat.SetupPositions() end @@ -305,7 +305,7 @@ pfUI:RegisterModule("firstrun", function () SkinCheckbox(f.checkbox, 18) f.NextScript = function() - if not pfUI.chat then message("Couldn't apply settings. Chat module is disabled.") end + if not pfUI.chat then message("Couldn't apply settings. Chat module is disabled.") return end if f.checkbox:GetChecked() then pfUI.chat.SetupChannels() end diff --git a/modules/map.lua b/modules/map.lua index ed0d50ca..a9bed3b4 100644 --- a/modules/map.lua +++ b/modules/map.lua @@ -77,7 +77,13 @@ pfUI:RegisterModule("map", function () if point == "TOPLEFT" and relpoint == "TOPLEFT" then offx = offx*oldscale/scale offy = offy*oldscale/scale - WorldMapFrame:SetPoint(point, rel, relpoint, offx, offy) + -- Anchor to the parent (3-arg SetPoint) rather than re-using the frame + -- GetPoint handed back. Re-anchoring to `rel` throws + -- " is dependent on this" as soon as anything else has anchored + -- itself to WorldMapFrame, which aborts the whole zoom handler. The + -- parent-relative form is also what LoadMovable/SaveMovable already + -- assume: SaveMovable stores only xpos/ypos, with no relative frame. + WorldMapFrame:SetPoint(point, offx, offy) end WorldMapFrame:SetScale(scale) diff --git a/modules/roll.lua b/modules/roll.lua index b3d6f886..9f1c81f8 100644 --- a/modules/roll.lua +++ b/modules/roll.lua @@ -43,6 +43,7 @@ pfUI:RegisterModule("roll", function () local _, _, itemLink = string.find(hyperlink, "(item:%d+:%d+:%d+:%d+)") local itemName = C_Item.GetItemInfo(itemLink) + if not itemName then return end -- uncached item: avoid cache[nil] "table index is nil" -- delete obsolete tables if pfUI.roll.cache[itemName] and pfUI.roll.cache[itemName]["TIMESTAMP"] < GetTime() - 60 then diff --git a/modules/unitxp.lua b/modules/unitxp.lua index 2a787b4e..e130e6cf 100644 --- a/modules/unitxp.lua +++ b/modules/unitxp.lua @@ -169,6 +169,9 @@ pfUI:RegisterModule("unitxp", function () local throttle = 0 local scanner = CreateFrame("Frame") + -- expose the poller frame so PLAYER_LOGOUT can stop its UnitXP OnUpdate + -- (it lives on this separate frame, not on distanceIndicator) -> crash 132 + pfUI.uf.target.distanceScanner = scanner scanner:SetScript("OnUpdate", function() throttle = throttle + arg1 if throttle < 0.05 then return end @@ -236,6 +239,10 @@ pfUI:RegisterModule("unitxp", function () if pfUI.uf.target.distanceIndicator then pfUI.uf.target.distanceIndicator:SetScript("OnUpdate", nil) end + -- free-frame mode polls from its own scanner frame, not the indicator + if pfUI.uf.target.distanceScanner then + pfUI.uf.target.distanceScanner:SetScript("OnUpdate", nil) + end end return end