diff --git a/CHANGELOG.md b/CHANGELOG.md index 61c9df0d4..58636f507 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ - Minor: Removed total views from the usercard, as Twitch no longer updates the number. (#3792) - Minor: Add Quick Switcher item to open a channel in a new popup window. (#3828) - Minor: Warn when parsing an environment variable fails. (#3904) -- Minor: Load missing messages from Recent Messages API upon reconnecting (#3878) +- Minor: Load missing messages from Recent Messages API upon reconnecting (#3878, #3932) - Bugfix: Fix crash that can occur when closing and quickly reopening a split, then running a command. (#3852) - Bugfix: Connection to Twitch PubSub now recovers more reliably. (#3643, #3716) - Bugfix: Fix crash that can occur when changing channels. (#3799) diff --git a/src/common/Channel.cpp b/src/common/Channel.cpp index 68cc29874..e47362572 100644 --- a/src/common/Channel.cpp +++ b/src/common/Channel.cpp @@ -237,7 +237,20 @@ void Channel::addMessagesAtStart(const std::vector &_messages) void Channel::fillInMissingMessages(const std::vector &messages) { + if (messages.empty()) + { + return; + } + auto snapshot = this->getMessageSnapshot(); + if (snapshot.size() == 0) + { + // There are no messages in this channel yet so we can just insert them + // at the front in order + this->messages_.pushFront(messages); + this->filledInMessages.invoke(messages); + return; + } std::unordered_set existingMessageIds; existingMessageIds.reserve(snapshot.size());