]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix a crash when trying to use ROUTE_TYPE_MESSAGE with no message.
authorPeter Powell <petpow@saberuk.com>
Wed, 2 Jan 2019 20:21:21 +0000 (20:21 +0000)
committerPeter Powell <petpow@saberuk.com>
Wed, 2 Jan 2019 20:28:48 +0000 (20:28 +0000)
src/modules/m_spanningtree/postcommand.cpp
src/modules/m_spanningtree/utils.cpp

index 448bb3b543f5827d553365a6d1dea7ed5b88c08a..d3eab825fec48ec09ed1c7124f152eb240e99a12 100644 (file)
@@ -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] == '$')
                {
index 42eb80de538ac8de354b0457e1e4fbeec25964ed..1f2ed9c90ea9acf61ff55fd64bcc6e9c5b5c29fc 100644 (file)
@@ -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);