fix(Core/Channel): potential nullptr reference in Channel::SetOwner() (#17906)

This commit is contained in:
Tristan 'Natrist' Cormier
2023-11-30 14:25:01 -05:00
committed by GitHub
parent e1cec2bbcf
commit 8eed7ee531

View File

@@ -884,23 +884,25 @@ void Channel::SetOwner(ObjectGuid guid, bool exclaim)
pinfo.SetModerator(true);
uint8 oldFlag = pinfo.flags;
pinfo.SetOwner(true);
Player* player = ObjectAccessor::FindPlayer(_ownerGUID);
WorldPacket data;
if (ShouldAnnouncePlayer(player))
{
MakeModeChange(&data, _ownerGUID, oldFlag);
SendToAll(&data);
}
FlagsNotify(pinfo.plrPtr);
if (exclaim && ShouldAnnouncePlayer(player))
Player* player = ObjectAccessor::FindPlayer(_ownerGUID);
if (player)
{
MakeOwnerChanged(&data, _ownerGUID);
SendToAll(&data);
if (ShouldAnnouncePlayer(player))
{
WorldPacket data;
MakeModeChange(&data, _ownerGUID, oldFlag);
SendToAll(&data);
if (exclaim)
{
// MakeOwnerChanged will reset the packet for us
MakeOwnerChanged(&data, _ownerGUID);
SendToAll(&data);
}
}
}
}
}