diff --git a/src/messages/MessageBuilder.cpp b/src/messages/MessageBuilder.cpp index 35b360b00..68e304bf3 100644 --- a/src/messages/MessageBuilder.cpp +++ b/src/messages/MessageBuilder.cpp @@ -2773,9 +2773,14 @@ void MessageBuilder::appendTwitchBadges(const QVariantMap &tags, if (sourceName.has_value()) { - this->emplace(makeSharedChatBadge(sourceName.value()), - MessageElementFlag::BadgeSharedChannel) - ->setLink({Link::UserInfo, sourceName.value()}); + const auto &name = sourceName.value(); + auto *badge = this->emplace( + makeSharedChatBadge(name), + MessageElementFlag::BadgeSharedChannel); + if (!name.isEmpty()) + { + badge->setLink({Link::UserInfo, name}); + } } }