View Single Post
12-08-14, 05:25 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Well, all else aside, calling IsInInstance() in your aura filtering function, which is called once per active aura per UNIT_AURA event -- so, potentially thousands of times per second in a raid -- is rather wasteful. Much better to keep track of that outside the function (create a separate frame if you need to) and refer to a variable inside.

As for the problem at hand, the caster unit can be -- and often is -- nil for auras applied by NPCs. Try changing this:

Code:
and not UnitPlayerControlled(caster) then
to this:

Code:
and not (caster and UnitPlayerControlled(caster)) then
Player-applied auras can also have a nil caster, but only if they're applied by players who don't currently have a unit token, so while you're in an instance that shouldn't really be an issue.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote