summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-19 20:06:01 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-19 20:06:01 +0000
commitb6c1d58023972a1833d017b25fd9146138f0c1f1 (patch)
treede0276ea13220fed453d44b989880e6bb964723a /src
parent56fc9a6b8b30f5c88120e1ddabcfdc92ae494dbe (diff)
Check some userrec values in remote whois, so that it wont crash if a user has quit before the IDLE command arrives.
Fixes bug #260 git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6814 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index c87e5d406..b7632ca6c 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -605,19 +605,20 @@ bool TreeSocket::Whois(const std::string &prefix, std::deque<std::string> &param
userrec* x = this->Instance->FindNick(params[0]);
char signon[MAXBUF];
char idle[MAXBUF];
- snprintf(signon,MAXBUF,"%lu",(unsigned long)x->signon);
- snprintf(idle,MAXBUF,"%lu",(unsigned long)abs((x->idle_lastmsg)-Instance->Time(true)));
+ snprintf(signon, MAXBUF, "%lu", (unsigned long)x->signon);
+ snprintf(idle, MAXBUF, "%lu", (unsigned long)abs((x->idle_lastmsg) - Instance->Time(true)));
std::deque<std::string> par;
par.push_back(prefix);
par.push_back(signon);
par.push_back(idle);
// ours, we're done, pass it BACK
- Utils->DoOneToOne(params[0],"IDLE",par,u->server);
+ Utils->DoOneToOne(params[0], "IDLE", par, u->server);
}
else
{
// not ours pass it on
- Utils->DoOneToOne(prefix,"IDLE",params,x->server);
+ if (x)
+ Utils->DoOneToOne(prefix, "IDLE", params, x->server);
}
}
else if (params.size() == 3)
@@ -631,12 +632,13 @@ bool TreeSocket::Whois(const std::string &prefix, std::deque<std::string> &param
unsigned long signon = atoi(params[1].c_str());
unsigned long idle = atoi(params[2].c_str());
if ((who_to_send_to) && (IS_LOCAL(who_to_send_to)))
- do_whois(this->Instance,who_to_send_to,u,signon,idle,nick_whoised.c_str());
+ do_whois(this->Instance, who_to_send_to, u, signon, idle, nick_whoised.c_str());
}
else
{
// not ours, pass it on
- Utils->DoOneToOne(prefix,"IDLE",params,who_to_send_to->server);
+ if (who_to_send_to)
+ Utils->DoOneToOne(prefix, "IDLE", params, who_to_send_to->server);
}
}
}