Quantcast

Always check that there is a unit available in UnitPopup hook.

Christopher Rosell [07-29-12 - 21:13]
Always check that there is a unit available in UnitPopup hook.
Filename
modules/lookup.lua
diff --git a/modules/lookup.lua b/modules/lookup.lua
index e8e34a0..fad46af 100755
--- a/modules/lookup.lua
+++ b/modules/lookup.lua
@@ -57,6 +57,7 @@ end

      I hope this doesn't make things blow up, at least it doesn't block "Set Focus". --]]
 local function UnitPopup_ShowMenu_hook(dropdown, which, unit, name, userdata)
+	if not unit then return end
 	if not (UnitIsWildBattlePet(unit) or UnitIsBattlePetCompanion(unit)) then return end
 	if UIDROPDOWNMENU_MENU_LEVEL ~= 1 then return end

@@ -97,7 +98,6 @@ function module:Enable()
 	hooksecurefunc("UnitPopup_ShowMenu", UnitPopup_ShowMenu_hook)
 end

-
 local function OnUpdate(self, e)
 	self.elapsed = self.elapsed + e