From 157eca58d7811e8fbb78c089c686050751bac45c Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Fri, 27 Sep 2019 14:12:10 +0200 Subject: Core/Misc: Fix static analysis issues Fix static analysis issues reported by Coverity (cherry picked from commit ca8953a0ec8356345147b2bbc7bbdf0fa97cd625) --- src/server/game/Chat/Channels/Channel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 022d4546a09..baea34a3108 100644 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -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 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)))) -- cgit v1.2.3