From dd58d13dd60dc39a2036c85394686c9d5988794b Mon Sep 17 00:00:00 2001 From: romracer Date: Wed, 5 Jun 2024 10:00:18 -0500 Subject: [PATCH] Fix "calling 'GetName' on bad self" In 4.1+ clients, which all modern and classic WoW clients are long descedents from (all clients are 10.0+ now), GetMouseFocus() can return nil when opening character frames (player or others like inspecting). This fixes calling GetName in those situations. Its probably a little overkill, but it works. --- ItemRack/ItemRack.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ItemRack/ItemRack.lua b/ItemRack/ItemRack.lua index bd347a2..da20407 100644 --- a/ItemRack/ItemRack.lua +++ b/ItemRack/ItemRack.lua @@ -1308,7 +1308,13 @@ end function ItemRack.MenuMouseover() local frame = GetMouseFocus() - if MouseIsOver(ItemRackMenuFrame) or IsShiftKeyDown() or (frame and frame:GetName() and frame:IsVisible() and ItemRack.MenuMouseoverFrames[frame:GetName()]) then + local frameName = nil + local frameVisible = nil + local IRmouseOverFrame = nil + if frame then frameName = frame:GetName() end + if frame then frameVisible = frame:IsVisible() end + if frameName then IRmouseOverFrame = ItemRack.MenuMouseoverFrames[frameName] end + if MouseIsOver(ItemRackMenuFrame) or IsShiftKeyDown() or (frame and frameName and frameVisible and IRmouseOverFrame) then return -- keep menu open if mouse over menu, shift is down or mouse is immediately over a mouseover frame end for i in pairs(ItemRack.MenuMouseoverFrames) do