From 96d561950c8086d132297eb691bf90bb2bc61a60 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Thu, 27 Mar 2014 15:41:47 +0100 Subject: m_watch Validate targ before use, noticed while rewriting m_watch for 2.2 --- src/modules/m_watch.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index ec38edc31..fa7e212bb 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -316,10 +316,10 @@ class CommandWatch : public Command { for (watchlist::iterator q = wl->begin(); q != wl->end(); q++) { - if (!q->second.empty()) + User* targ = ServerInstance->FindNick(q->first.c_str()); + if (targ && !q->second.empty()) { user->WriteNumeric(604, "%s %s %s :is online", user->nick.c_str(), q->first.c_str(), q->second.c_str()); - User *targ = ServerInstance->FindNick(q->first.c_str()); if (IS_AWAY(targ)) { user->WriteNumeric(609, "%s %s %s %s %lu :is away", user->nick.c_str(), targ->nick.c_str(), targ->ident.c_str(), targ->dhost.c_str(), (unsigned long) targ->awaytime); -- cgit v1.2.3