From 2ed62165fab47e53d2306457dd029fc13d3016fb Mon Sep 17 00:00:00 2001 From: pajlada Date: Sat, 22 Apr 2023 19:44:23 +0200 Subject: [PATCH] Fix crash when using /unstable-set-user-color without any arguments (#4574) I told you it was unstable --- src/controllers/commands/CommandController.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index 5fe738fa5..302dfd9d3 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -3190,14 +3190,16 @@ void CommandController::initialize(Settings &, Paths &paths) "works in Twitch channels")); return ""; } - auto userID = ctx.words.at(1); if (ctx.words.size() < 2) { ctx.channel->addMessage( makeSystemMessage(QString("Usage: %1 [color]") .arg(ctx.words.at(0)))); + return ""; } + auto userID = ctx.words.at(1); + auto color = ctx.words.value(2); getIApp()->getUserData()->setUserColor(userID, color);