UNIT_SPELLCAST_START and
UNIT_SPELLCAST_CHANNEL_START aren't returning the values that are
nil. Those are from
UnitCastingInfo(). The code doesn't check if the event firing is for the player while it only runs for the player castbar. So it's asking
UnitCastingInfo() to check the player when the target starts casting.
I would suggest replacing this line to be a little more robust:
Code:
if (self.unit~="player") then return end
-with-
Code:
if not UnitIsUnit(self.unit,"player") or not UnitIsUnit(unit,"player") then return; end
This will also proc on other bars if the unit happens to be pointing to the player (like target if you're targeting yourself).
Alternate:
Code:
if self.unit~="player" or not UnitIsUnit(self.unit,unit) then return; end
This will still restrict to the player castbar, but still checks if the event is firing for it.