fix crash in name-colorizer

This commit is contained in:
Rasmus Karlsson 2019-08-11 22:18:01 +02:00
parent cd5972522b
commit e56c90c33d
2 changed files with 15 additions and 4 deletions

View file

@ -502,17 +502,27 @@ void TwitchMessageBuilder::appendChannelName()
->setLink(link);
}
void TwitchMessageBuilder::parseUsername()
void TwitchMessageBuilder::parseUsernameColor()
{
const auto iterator = this->tags.find("color");
if (iterator != this->tags.end())
{
if (const auto color = iterator.value().toString(); !color.isEmpty())
{
this->usernameColor_ = QColor(color);
return;
}
else if (getSettings()->colorizeNicknames && this->tags.contains("user-id"))
}
if (getSettings()->colorizeNicknames && this->tags.contains("user-id"))
{
this->usernameColor_ = getRandomColor(this->tags.value("user-id"));
}
}
void TwitchMessageBuilder::parseUsername()
{
this->parseUsernameColor();
// username
this->userName = this->ircMessage->nick();

View file

@ -52,6 +52,7 @@ private:
void parseMessageID();
void parseRoomID();
void appendChannelName();
void parseUsernameColor();
void parseUsername();
void appendUsername();
void runIgnoreReplaces(