diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-07-04 19:42:20 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2012-07-04 19:42:20 +0200 |
commit | 0c6bb6f536eecf1f06fb020b2e9ad7ba67d0ede5 (patch) | |
tree | 37ea1391ce6c960f6180073ce288d24aa7a2b082 | |
parent | 2d01e788b2d7d53200a711b4a5e388f454188def (diff) |
m_spanningtree Fix crash in SVSPART handler when the given channel doesn't exist
-rw-r--r-- | src/modules/m_spanningtree/svspart.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
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<std::string>& 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; } |