From 0c6bb6f536eecf1f06fb020b2e9ad7ba67d0ede5 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 4 Jul 2012 19:42:20 +0200 Subject: m_spanningtree Fix crash in SVSPART handler when the given channel doesn't exist --- src/modules/m_spanningtree/svspart.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/svspart.cpp b/src/modules/m_spanningtree/svspart.cpp index 7edc720af..35bce781d 100644 --- a/src/modules/m_spanningtree/svspart.cpp +++ b/src/modules/m_spanningtree/svspart.cpp @@ -30,17 +30,19 @@ CmdResult CommandSVSPart::Handle(const std::vector& parameters, User *user) { - std::string reason = "Services forced part"; + User* u = ServerInstance->FindUUID(parameters[0]); + if (!u) + return CMD_FAILURE; - if (parameters.size() == 3) - reason = parameters[2]; - - User* u = ServerInstance->FindNick(parameters[0]); Channel* c = ServerInstance->FindChan(parameters[1]); + if (!c) + return CMD_FAILURE; - if (u && IS_LOCAL(u)) + if (IS_LOCAL(u)) + { + std::string reason = (parameters.size() == 3) ? parameters[2] : "Services forced part"; c->PartUser(u, reason); - + } return CMD_SUCCESS; } -- cgit v1.2.3