mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Fix crash when adding recent messages to empty Channel (#3932)
* Fix crash when adding recent messages to empty Channel * Update CHANGELOG.md
This commit is contained in:
parent
c204332685
commit
33db006635
2 changed files with 14 additions and 1 deletions
|
@ -26,7 +26,7 @@
|
||||||
- Minor: Removed total views from the usercard, as Twitch no longer updates the number. (#3792)
|
- 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: Add Quick Switcher item to open a channel in a new popup window. (#3828)
|
||||||
- Minor: Warn when parsing an environment variable fails. (#3904)
|
- 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: 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: Connection to Twitch PubSub now recovers more reliably. (#3643, #3716)
|
||||||
- Bugfix: Fix crash that can occur when changing channels. (#3799)
|
- Bugfix: Fix crash that can occur when changing channels. (#3799)
|
||||||
|
|
|
@ -237,7 +237,20 @@ void Channel::addMessagesAtStart(const std::vector<MessagePtr> &_messages)
|
||||||
|
|
||||||
void Channel::fillInMissingMessages(const std::vector<MessagePtr> &messages)
|
void Channel::fillInMissingMessages(const std::vector<MessagePtr> &messages)
|
||||||
{
|
{
|
||||||
|
if (messages.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto snapshot = this->getMessageSnapshot();
|
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<QString> existingMessageIds;
|
std::unordered_set<QString> existingMessageIds;
|
||||||
existingMessageIds.reserve(snapshot.size());
|
existingMessageIds.reserve(snapshot.size());
|
||||||
|
|
Loading…
Reference in a new issue