mirror of
https://github.com/znc/znc.git
synced 2026-08-06 17:03:14 +02:00
Fix a potential crash bug on channel part (CChan::RemNick())
This function didn't properly check it had a valid iterator *before* using this iterator (.begin()->second). Now we first check if that iterator is valid (size() is *not* zero) before we run this. No behaviour is changed, but the bug is gone. Yay. ;) git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1133 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -530,11 +530,14 @@ bool CChan::RemNick(const CString& sNick) {
|
||||
|
||||
delete it->second;
|
||||
m_msNicks.erase(it);
|
||||
CNick* pNick = m_msNicks.begin()->second;
|
||||
|
||||
if ((m_msNicks.size() == 1) && (!pNick->HasPerm(Op)) && (pNick->GetNick().CaseCmp(m_pUser->GetCurNick()) == 0)) {
|
||||
if (AutoCycle()) {
|
||||
Cycle();
|
||||
if (m_msNicks.size() == 1) {
|
||||
CNick* pNick = m_msNicks.begin()->second;
|
||||
|
||||
if (!pNick->HasPerm(Op) && pNick->GetNick().CaseCmp(m_pUser->GetCurNick()) == 0) {
|
||||
if (AutoCycle()) {
|
||||
Cycle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user