From f1a39c006f68269437811b23ae27bfd2af25fd83 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Sat, 16 Oct 2021 16:54:25 -0400 Subject: fix potential crash when loading channel with no messages --- components/chatlist.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'components/chatlist.cpp') 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) { -- cgit v1.2.3