summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2021-10-16 16:54:25 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2021-10-16 16:54:25 -0400
commitf1a39c006f68269437811b23ae27bfd2af25fd83 (patch)
tree36780e98408b1287e1558eab78a5b4482b62e71b
parent3e34f785c6762fa4320c9c131ff771bdb2a3f74e (diff)
downloadabaddon-portaudio-f1a39c006f68269437811b23ae27bfd2af25fd83.tar.gz
abaddon-portaudio-f1a39c006f68269437811b23ae27bfd2af25fd83.zip
fix potential crash when loading channel with no messages
-rw-r--r--components/chatlist.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/components/chatlist.cpp b/components/chatlist.cpp
index 96d8de2..5b3f357 100644
--- a/components/chatlist.cpp
+++ b/components/chatlist.cpp
@@ -243,7 +243,10 @@ void ChatList::RefetchMessage(Snowflake id) {
}
Snowflake ChatList::GetOldestListedMessage() {
- return m_id_to_widget.begin()->first;
+ if (m_id_to_widget.size() > 0)
+ return m_id_to_widget.begin()->first;
+ else
+ return Snowflake::Invalid;
}
void ChatList::UpdateMessageReactions(Snowflake id) {