summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2019-01-02 20:21:21 +0000
committerPeter Powell <petpow@saberuk.com>2019-01-02 20:28:48 +0000
commite433401fb883584d32b9b8159370ee57823b01bf (patch)
tree9031adea3ee5a5675bb94aac0498ee45d0ddcee1 /src/modules
parentaafc03bdfc34c9426df44938403c92dbbbc0568e (diff)
Fix a crash when trying to use ROUTE_TYPE_MESSAGE with no message.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree/postcommand.cpp5
-rw-r--r--src/modules/m_spanningtree/utils.cpp4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp
index 448bb3b54..d3eab825f 100644
--- a/src/modules/m_spanningtree/postcommand.cpp
+++ b/src/modules/m_spanningtree/postcommand.cpp
@@ -101,7 +101,10 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm
return;
// TODO OnBuildExemptList hook was here
CUList exempts;
- SendChannelMessage(user->uuid, c, parameters[1], pfx, parameters.GetTags(), exempts, command.c_str(), origin ? origin->GetSocket() : NULL);
+ std::string message;
+ if (parameters.size() >= 2)
+ message.assign(parameters[1]);
+ SendChannelMessage(user->uuid, c, message, pfx, parameters.GetTags(), exempts, command.c_str(), origin ? origin->GetSocket() : NULL);
}
else if (dest[0] == '$')
{
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 42eb80de5..1f2ed9c90 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -359,7 +359,9 @@ void SpanningTreeUtilities::SendChannelMessage(const std::string& prefix, Channe
msg.push_raw(' ');
if (status != 0)
msg.push_raw(status);
- msg.push_raw(target->name).push_last(text);
+ msg.push_raw(target->name);
+ if (!text.empty())
+ msg.push_last(text);
TreeSocketSet list;
this->GetListOfServersForChannel(target, list, status, exempt_list);