Fix crash on missing parameters with IRC /kick command (#3382)

This commit is contained in:
pajlada
2021-12-04 16:37:53 +01:00
committed by GitHub
parent 3fcb6346f5
commit 568f65213d
2 changed files with 18 additions and 4 deletions
+17 -4
View File
@@ -55,11 +55,24 @@ Outcome invokeIrcCommand(const QString &commandName, const QString &allParams,
}
else if (cmd == "kick")
{
if (paramsAfter(1).isEmpty())
sendRaw("KICK " + params[0] + " " + params[1]);
if (params.size() < 2)
{
channel.addMessage(
makeSystemMessage("Usage: /kick <channel> <client> [message]"));
return Failure;
}
const auto &channelParam = params[0];
const auto &clientParam = params[1];
const auto &messageParam = paramsAfter(1);
if (messageParam.isEmpty())
{
sendRaw("KICK " + channelParam + " " + clientParam);
}
else
sendRaw("KICK " + params[0] + " " + params[1] + " :" +
paramsAfter(1));
{
sendRaw("KICK " + channelParam + " " + clientParam + " :" +
messageParam);
}
}
else if (cmd == "wallops")
{