diff --git a/CHANGELOG.md b/CHANGELOG.md index 691641f6..fc9c0183 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ - Bugfix: Fixed eventsub message delete notifications not being affected by "Show deletions of single messages". (#6233) - Bugfix: Don't add reply buttons to messages that are invalid reply targets. (#6119) - Bugfix: Fixed invalid commands from being forwarded to Helix, making it possible for information to leak (e.g. if you typed `/bann username ban reason` it would be seen by others in chat as `username ban reason`). (#6272, #6330) +- Bugfix: Fixed a crash that occurs when searching for emotes in channel-less contexts. (#6357) - Dev: Mini refactor of Split. (#6148) - Dev: Conan will no longer generate a `CMakeUserPresets.json` file. (#6117) - Dev: Pass `--force-openssl` when installing from CMake in Qt 6.8+. (#6129) diff --git a/src/widgets/dialogs/EmotePopup.cpp b/src/widgets/dialogs/EmotePopup.cpp index 404d8820..0972198b 100644 --- a/src/widgets/dialogs/EmotePopup.cpp +++ b/src/widgets/dialogs/EmotePopup.cpp @@ -422,11 +422,6 @@ void EmotePopup::loadChannel(ChannelPtr channel) this->setWindowTitle("Emotes in #" + this->channel_->getName()); - if (this->twitchChannel_ == nullptr) - { - return; - } - this->globalEmotesView_->setChannel( std::make_shared("", Channel::Type::None)); this->subEmotesView_->setChannel( @@ -441,11 +436,6 @@ void EmotePopup::loadChannel(ChannelPtr channel) void EmotePopup::reloadEmotes() { - if (this->twitchChannel_ == nullptr) - { - return; - } - auto subChannel = this->subEmotesView_->underlyingChannel(); auto globalChannel = this->globalEmotesView_->underlyingChannel(); auto channelChannel = this->channelEmotesView_->underlyingChannel(); @@ -454,13 +444,32 @@ void EmotePopup::reloadEmotes() globalChannel->clearMessages(); channelChannel->clearMessages(); - // twitch - addTwitchEmoteSets( - twitchChannel_->localTwitchEmotes(), - *getApp()->getAccounts()->twitch.getCurrent()->accessEmoteSets(), - *globalChannel, *subChannel, twitchChannel_->roomId(), - twitchChannel_->getName()); + if (this->twitchChannel_) + { + // twitch + addTwitchEmoteSets( + twitchChannel_->localTwitchEmotes(), + *getApp()->getAccounts()->twitch.getCurrent()->accessEmoteSets(), + *globalChannel, *subChannel, twitchChannel_->roomId(), + twitchChannel_->getName()); + // channel + if (Settings::instance().enableBTTVChannelEmotes) + { + addEmotes(*channelChannel, *this->twitchChannel_->bttvEmotes(), + "BetterTTV", MessageElementFlag::BttvEmote); + } + if (Settings::instance().enableFFZChannelEmotes) + { + addEmotes(*channelChannel, *this->twitchChannel_->ffzEmotes(), + "FrankerFaceZ", MessageElementFlag::FfzEmote); + } + if (Settings::instance().enableSevenTVChannelEmotes) + { + addEmotes(*channelChannel, *this->twitchChannel_->seventvEmotes(), + "7TV", MessageElementFlag::SevenTVEmote); + } + } // global if (Settings::instance().enableBTTVGlobalEmotes) { @@ -478,23 +487,6 @@ void EmotePopup::reloadEmotes() "7TV", MessageElementFlag::SevenTVEmote); } - // channel - if (Settings::instance().enableBTTVChannelEmotes) - { - addEmotes(*channelChannel, *this->twitchChannel_->bttvEmotes(), - "BetterTTV", MessageElementFlag::BttvEmote); - } - if (Settings::instance().enableFFZChannelEmotes) - { - addEmotes(*channelChannel, *this->twitchChannel_->ffzEmotes(), - "FrankerFaceZ", MessageElementFlag::FfzEmote); - } - if (Settings::instance().enableSevenTVChannelEmotes) - { - addEmotes(*channelChannel, *this->twitchChannel_->seventvEmotes(), - "7TV", MessageElementFlag::SevenTVEmote); - } - if (subChannel->getMessageSnapshot().size() == 0) { MessageBuilder builder;