From 260678634eacf0992b5b3c5b163625cf4ab62bbd Mon Sep 17 00:00:00 2001
From: AlexeyZavar <sltkval1@gmail.com>
Date: Sat, 5 Oct 2024 05:30:56 +0300
Subject: [PATCH] fix: most frequent crashes

---
 Telegram/SourceFiles/dialogs/dialogs_main_list.cpp | 2 +-
 Telegram/SourceFiles/history/history_widget.cpp    | 2 +-
 Telegram/lib_ui                                    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Telegram/SourceFiles/dialogs/dialogs_main_list.cpp b/Telegram/SourceFiles/dialogs/dialogs_main_list.cpp
index 9c9ad67ba..f9480a818 100644
--- a/Telegram/SourceFiles/dialogs/dialogs_main_list.cpp
+++ b/Telegram/SourceFiles/dialogs/dialogs_main_list.cpp
@@ -121,7 +121,7 @@ void MainList::unreadStateChanged(
 	const auto notifier = unreadStateChangeNotifier(notify);
 	_unreadState += nowState - wasState;
 	if (updateCloudUnread) {
-		Assert(nowState.known);
+		// Assert(nowState.known);
 		_cloudUnreadState += nowState - wasState;
 		finalizeCloudUnread();
 	}
diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp
index 2b99ff45c..0266779be 100644
--- a/Telegram/SourceFiles/history/history_widget.cpp
+++ b/Telegram/SourceFiles/history/history_widget.cpp
@@ -3527,7 +3527,7 @@ void HistoryWidget::messagesReceived(
 		const MTPmessages_Messages &messages,
 		int requestId) {
 	// Expects(_history != nullptr);
-	if (!_history) {
+	if (!_history || !_peer) {
 		return; // AyuGram: fix crash when using `saveDeletedMessages`
 	}
 
diff --git a/Telegram/lib_ui b/Telegram/lib_ui
index 05601adb9..b0beb8a16 160000
--- a/Telegram/lib_ui
+++ b/Telegram/lib_ui
@@ -1 +1 @@
-Subproject commit 05601adb9f045f54ca8377d0555dae6d5ce48c7d
+Subproject commit b0beb8a162168ebeacafa2ff23b21addb4154e69