Total-RP / Total-RP-3

The best roleplaying add-on for World of Warcraft.
http://curse.totalrp.com
Apache License 2.0
34 stars 19 forks source link

Avoid rare errors in tooltip SetPoint calls #893

Closed Meorawr closed 2 months ago

Meorawr commented 2 months ago

The ui_CharacterTT:SetPoint call can fail in rare circumstances where the normal tooltip frame has no anchor points, and the addon is configured to replace the original tooltip.

I believe this is related to the changes to add soft target support; presumably what happens is that there's extremely rare scenarios where GameTooltip:SetWorldCursor is called by the client for an object that has no tooltip data (or at least, nothing cached). In such a case the tooltip probably never shows, has no anchor points, and our hook then attempts to set up an RP profile tooltip and ends up choking on the nil return from GetPoint being passed into SetPoint.

Hypothetically this problem could also exist for normal GameTooltip:SetUnit calls, we've probably just been lucky enough to not see it there so far.

As such - if the original tooltip has no anchors, we'll fall back and use the default anchor point that the original tooltip would normally have. Odds are we don't even have a valid unit in this case anyway, so we'll probably display nothing - but at least this way we avoid the error and - if there is something - we'll at least show it somewhere sensible.