mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 02:25:38 +01:00
Core/Misc: Fix static analysis issues
Fix static analysis issues reported by Coverity
(cherry picked from commit ca8953a0ec)
This commit is contained in:
@@ -350,7 +350,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
|
||||
|
||||
Player* bad = ObjectAccessor::FindConnectedPlayerByName(badname);
|
||||
ObjectGuid const& victim = bad ? bad->GetGUID() : ObjectGuid::Empty;
|
||||
if (!victim || !IsOn(victim))
|
||||
if (!bad || !victim || !IsOn(victim))
|
||||
{
|
||||
PlayerNotFoundAppend appender(badname);
|
||||
ChannelNameBuilder<PlayerNotFoundAppend> builder(this, appender);
|
||||
@@ -495,7 +495,7 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
|
||||
Player* newp = ObjectAccessor::FindConnectedPlayerByName(p2n);
|
||||
ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty;
|
||||
|
||||
if (victim.IsEmpty() || !IsOn(victim) ||
|
||||
if (!newp || victim.IsEmpty() || !IsOn(victim) ||
|
||||
(player->GetTeam() != newp->GetTeam() &&
|
||||
(!player->GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL) ||
|
||||
!newp->GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL))))
|
||||
@@ -556,7 +556,7 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
|
||||
Player* newp = ObjectAccessor::FindConnectedPlayerByName(newname);
|
||||
ObjectGuid victim = newp ? newp->GetGUID() : ObjectGuid::Empty;
|
||||
|
||||
if (!victim || !IsOn(victim) ||
|
||||
if (!newp || !victim || !IsOn(victim) ||
|
||||
(player->GetTeam() != newp->GetTeam() &&
|
||||
(!player->GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL) ||
|
||||
!newp->GetSession()->HasPermission(rbac::RBAC_PERM_TWO_SIDE_INTERACTION_CHANNEL))))
|
||||
|
||||
Reference in New Issue
Block a user