View Single Post
03-12-11, 05:43 AM   #34
tinyu
A Molten Giant
 
tinyu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 837
Originally Posted by SDPhantom View Post
I've had this error pop up through my own addon code for a while and it's completely in Blizzard's UI. If Blizzard_InspectUI loads for any reason, even manually inspecting a player through Blizzard's own menus, the Inspection UI registers for the INSPECT_READY event. If this event were to fire at all while the inspection window is closed, it runs into an error with the stored UnitID being nil.

The following is a modified version of patch code I wrote a long time ago to fix this problem.
lua Code:
  1. local function patch()
  2.     local oldfunc1=InspectPaperDollFrame_SetLevel;
  3.     InspectPaperDollFrame_SetLevel=function(...)
  4.         if InspectFrame.unit and UnitExists(InspectFrame.unit) then
  5.             return oldfunc1(...);
  6.         end
  7.     end;
  8.  
  9.     local oldfunc2=InspectGuildFrame_Update;
  10.     InspectGuildFrame_Update=function(...)
  11.         if InspectFrame.unit and UnitExists(InspectFrame.unit) then
  12.             return oldfunc2(...);
  13.         end
  14.     end;
  15. end
  16.  
  17. if IsAddOnLoaded("Blizzard_InspectUI") then
  18.     patch();
  19. else
  20.     local eframe=CreateFrame("Frame");
  21.     eframe:RegisterEvent("ADDON_LOADED");
  22.     eframe:SetScript("OnEvent",function(self,event,arg)
  23.         if event=="ADDON_LOADED" and arg=="Blizzard_InspectUI" then
  24.             self:UnregisterEvent(event);
  25.             patch();
  26.         end
  27.     end);
  28. end
and where would i paste this?
__________________
"There's no such thing as too many addons."
Lothaer
Titan Dev Team Member.