UnitIsUnit() is expecting two units to compare equality. This is commonly used to check if a firing UNIT_* event is for a script's unitframe. We're already grabbing our unit from the buff frame, there's nothing to compare with here.
If you want to check if a unit exists, you need to use
UnitExists(). Considering the hooked function doesn't even fire when the unit doesn't exist, this is also pointless.
This is the updated script without any filtering.
Lua Code:
local function TargetFrame_UpdateAuras(self)
for buff in self.auraPools:GetPool("TargetBuffFrameTemplate"):EnumerateActive() do
local data=C_UnitAuras.GetAuraDataByAuraInstanceID(buff.unit,buff.auraInstanceID);
buff.Stealable:SetShown(data.isStealable or data.dispelName=="Magic");
end
end
hooksecurefunc(TargetFrame,"UpdateAuras",TargetFrame_UpdateAuras);
hooksecurefunc(FocusFrame,"UpdateAuras",TargetFrame_UpdateAuras);