nameplates: skip destroyed plates on PLAYER_LOGOUT

Leaving the world destroys the units before PLAYER_LOGOUT fires, so some
plates in the registry are already dead: their overlay buttons dropped
their events and lost their methods, and UnregisterAllEvents errored as a
nil method. Only silence the plates that are still alive.
This commit is contained in:
Brues
2026-10-25 11:33:51 -05:00
parent e4f0849816
commit cdaf9336a3
+4 -2
View File
@@ -524,9 +524,11 @@ nameplates:RegisterUnitEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE", "target", "focu
end
-- The plates hold their own unit subscriptions now, so silencing this
-- frame alone would leave them dispatching through logout -- exactly what
-- this branch exists to prevent.
-- this branch exists to prevent. Leaving the world destroys the units
-- before PLAYER_LOGOUT fires, and a destroyed plate already dropped its
-- events and lost its methods, so only the live ones need silencing.
for plate in pairs(registry) do
if plate.nameplate then
if plate.nameplate and plate.nameplate.UnregisterAllEvents then
plate.nameplate:UnregisterAllEvents()
plate.nameplate:SetScript("OnEvent", nil)
end