From ff3597031826359ec6b6fdec7f275483c6398cfc Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 11 Sep 2011 10:50:27 +0200 Subject: [PATCH] OnClientDisconnect() always needs a valid user If a client disconnected before completing the authentication, OnClientDisconnect() was called with m_pUser == NULL. This problem is new since previously MODULECALL silently failed if it got a NULL. Thanks to ex0a for repeatedly crashing his znc to figure this out. :-P Signed-off-by: Uli Schlachter --- Client.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Client.cpp b/Client.cpp index dc7e3408..e0725608 100644 --- a/Client.cpp +++ b/Client.cpp @@ -685,7 +685,9 @@ void CClient::Disconnected() { DEBUG(GetSockName() << " == Disconnected()"); SetNetwork(NULL, true, false); - MODULECALL(OnClientDisconnect(), m_pUser, m_pNetwork, this, NOTHING); + if (m_pUser) { + MODULECALL(OnClientDisconnect(), m_pUser, m_pNetwork, this, NOTHING); + } } void CClient::ReachedMaxBuffer() {