diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-12-28 17:25:30 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-12-28 17:25:30 +0100 |
commit | 419537e7453928af2fde6648e87085a27e443486 (patch) | |
tree | 132c13c1aa8ccc710922a5a8af87b99e3bc2f582 /src | |
parent | 299f262a4fd1c0a508a5b6748761128a2c3efde9 (diff) |
Invert if in Channel::PartUser()
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 6e3bc5e04..da5f4fd75 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -409,19 +409,19 @@ void Channel::PartUser(User *user, std::string &reason) { MemberMap::iterator membiter = userlist.find(user); - if (membiter != userlist.end()) - { - Membership* memb = membiter->second; - CUList except_list; - FOREACH_MOD(OnUserPart, (memb, reason, except_list)); + if (membiter == userlist.end()) + return; + + Membership* memb = membiter->second; + CUList except_list; + FOREACH_MOD(OnUserPart, (memb, reason, except_list)); - WriteAllExcept(user, false, 0, except_list, "PART %s%s%s", this->name.c_str(), reason.empty() ? "" : " :", reason.c_str()); + WriteAllExcept(user, false, 0, except_list, "PART %s%s%s", this->name.c_str(), reason.empty() ? "" : " :", reason.c_str()); - // Remove this channel from the user's chanlist - user->chans.erase(memb); - // Remove the Membership from this channel's userlist and destroy it - this->DelUser(membiter); - } + // Remove this channel from the user's chanlist + user->chans.erase(memb); + // Remove the Membership from this channel's userlist and destroy it + this->DelUser(membiter); } void Channel::KickUser(User* src, const MemberMap::iterator& victimiter, const std::string& reason) |