From 7993c6207a71a0a4e01a1329660f88d20c82cbc3 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 7 Nov 2022 20:13:35 +0300 Subject: [PATCH] Fixed crash on checking sponsored state with closed dialog. --- Telegram/SourceFiles/history/history_widget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 4c11812887..dc4b17bb50 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -2289,7 +2289,10 @@ void HistoryWidget::showHistory( { _scroll->setTrackingContent(false); - const auto checkState = crl::guard(this, [=] { + const auto checkState = crl::guard(this, [=, history = _history] { + if (history != _history) { + return; + } auto &sponsored = session().data().sponsoredMessages(); using State = Data::SponsoredMessages::State; const auto state = sponsored.state(_history);