Fix crash when using /unstable-set-user-color without any arguments (#4574)

I told you it was unstable
This commit is contained in:
pajlada 2023-04-22 19:44:23 +02:00 committed by GitHub
parent 6d2605d4ca
commit 2ed62165fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 <TwitchUserID> [color]")
.arg(ctx.words.at(0))));
return "";
}
auto userID = ctx.words.at(1);
auto color = ctx.words.value(2);
getIApp()->getUserData()->setUserColor(userID, color);