From 021f1a0bfc7c77c18aaa7f65a62f7263b7db6893 Mon Sep 17 00:00:00 2001 From: iProdigy Date: Sun, 20 Oct 2024 21:48:05 -0700 Subject: [PATCH] fix: skip UserInfo link if name is empty --- src/messages/MessageBuilder.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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}); + } } }