Thread Tools Display Modes
04-19-09, 04:10 PM   #1
Barjack
A Black Drake
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 89
Thumbs down When UnitReaction returns nil

So, when a bar has bar.colorReaction set to true, the default health update function can behave a little oddly. The check on that line is simply
Code:
elseif(bar.colorReaction) then
which does not guarantee there is a valid reaction for the unit. For instance on a target frame without something like colorClassPet, targeting a partypet in a different instance will return nil. As a result the bar's color is not changed at all and it will just retain the color of the previously targeted unit.

I'm not 100% sure if this would be considered a bug but, the way that if chain works makes it feel like it's supposed to continue falling through until it finds a valid color for the bar. But as long as colorReaction is true it cannot fall through to colorSmooth or colorHealth ever, even if there is no valid reaction for the unit.

Anyway, in my copy I just stuck
Code:
and UnitReaction(unit, "player") ~= nil
onto the end of that condition. But I don't know if that was specifically not done for performance reasons, or if it was just an oversight, or if it's intentional design or what, so I thought I'd at least bring it up.
  Reply With Quote
04-19-09, 04:55 PM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
When would UnitReaction ever be nil?
  Reply With Quote
04-19-09, 09:45 PM   #3
Barjack
A Black Drake
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 89
Originally Posted by p3lim View Post
When would UnitReaction ever be nil?
I gave an example in the post:
For instance on a target frame without something like colorClassPet, targeting a partypet in a different instance will return nil.
Edit: Which is to say, UnitReaction("player", "target") and UnitReaction("target", "player") are both nil when you target a pet in a different instance to you. There may be other cases also, but for certain that is one. Unless I'm experiencing some sort of bug anyway, but that's what it's returning for me.

Last edited by Barjack : 04-19-09 at 10:37 PM.
  Reply With Quote
04-20-09, 05:43 AM   #4
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
I'll consider it a bug. It would be nice if you had posted it in the bug report section on my portal tho', that way it would actually have been included in the 1.3.12 release.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » When UnitReaction returns nil


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off