From 4108debca0f671dc15d2689270bf2f92d5b9fa5a Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 30 Jul 2024 12:40:33 +0200 Subject: [PATCH] Fix possible crash in web apps. --- Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp index a8dee5f76..b2159ebb1 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp @@ -746,8 +746,9 @@ postEvent: function(eventType, eventData) { &QGuiApplication::focusWindowChanged ) | rpl::filter([=](QWindow *focused) { const auto handle = _widget->window()->windowHandle(); - return _webview - && !_webview->window.widget()->isHidden() + const auto widget = _webview ? _webview->window.widget() : nullptr; + return widget + && !widget->isHidden() && handle && (focused == handle); }) | rpl::start_with_next([=] {