summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-03-27 15:41:47 +0100
committerAttila Molnar <attilamolnar@hush.com>2014-03-27 15:41:47 +0100
commit96d561950c8086d132297eb691bf90bb2bc61a60 (patch)
tree37af2129c4731c6426ddd1dc64dd067aba45dfd7 /src/modules
parent730128891aa71e2fec2f6210f2ebf339e233cd01 (diff)
m_watch Validate targ before use, noticed while rewriting m_watch for 2.2
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_watch.cpp4
1 files 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);