Skip to content

Commit

Permalink
Fix "calling 'GetName' on bad self"
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
romracer authored and Rottenbeer committed Sep 27, 2024
1 parent b6865f2 commit dd58d13
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ItemRack/ItemRack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dd58d13

Please sign in to comment.