Core/Misc: Fix static analysis issues

Fix static analysis issues reported by Coverity
This commit is contained in:
Giacomo Pozzoni
2019-09-27 14:12:10 +02:00
parent 176f51d1e8
commit ca8953a0ec

View File

@@ -316,7 +316,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
Player* bad = ObjectAccessor::FindConnectedPlayerByName(badname);
ObjectGuid victim = bad ? bad->GetGUID() : ObjectGuid::Empty;
if (!victim || !IsOn(victim))
if (!bad || !victim || !IsOn(victim))
{
PlayerNotFoundAppend appender(badname);
ChannelNameBuilder<PlayerNotFoundAppend> builder(this, appender);
@@ -463,7 +463,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 || !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))))
@@ -558,7 +558,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))))