fix: skip UserInfo link if name is empty

This commit is contained in:
iProdigy 2024-10-20 21:48:05 -07:00
parent e87302ca2d
commit 021f1a0bfc

View file

@ -2773,9 +2773,14 @@ void MessageBuilder::appendTwitchBadges(const QVariantMap &tags,
if (sourceName.has_value())
{
this->emplace<BadgeElement>(makeSharedChatBadge(sourceName.value()),
MessageElementFlag::BadgeSharedChannel)
->setLink({Link::UserInfo, sourceName.value()});
const auto &name = sourceName.value();
auto *badge = this->emplace<BadgeElement>(
makeSharedChatBadge(name),
MessageElementFlag::BadgeSharedChannel);
if (!name.isEmpty())
{
badge->setLink({Link::UserInfo, name});
}
}
}