Quantcast WoWInterface - View Single Post - Adding %HP to default nameplates; getting an error occasionally
View Single Post
03-30-18, 05:48 PM   #9
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,059
The issue is that you're scanning for nameplates by looping through the children of WorldFrame, then you're trying to call a function on the frame (plate:GetName()), and if that frame happens to be forbidden it will throw an error.

You could add a check like if not plate:IsForbidden(), and put the rest of your function inside of that, or you can use the actual nameplate events that they added a couple years ago with the launch of Legion (NAME_PLATE_CREATED, NAME_PLATE_UNIT_ADDED, NAME_PLATE_UNIT_REMOVED).

The protected friendly nameplates in instances are implemented in a way that addons don't need to do anything to account for their existence; they don't trigger the same nameplate events and are completely separate from the standard nameplate frames, so unless you're doing something like actively scanning through every child of WorldFrame, you won't accidentally encounter them.
  Reply With Quote