The problem is as I described -- buffs cast by players who are not currently in your group will also have a nil caster. If you don't care about that (mainly an issue in town) then no, you don't need to check that you're in an instance.
Also:
1. You may want to show all debuffs on yourself, even if you can't dispel them.
2. You can combine the first and third of these checks:
Code:
-- show when debuff and by me
elseif icon.isDebuff and isPlayer[caster] then
return true
-- show stealable buffs
elseif isStealable and not icon.isDebuff then
return true
-- show when by me and is not debuff
elseif isPlayer[caster] and not icon.isDebuff then
return true
Since you want to show anything you cast, regardless of whether it's a debuff or not, you don't need to check if it is a debuff, and then again if it's not a debuff.