From aa674a0ea5bb96af15d96af0f06afde4d0a7ccc7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 23 Sep 2022 15:53:58 +0400 Subject: [PATCH] Fix UB in closing chat across all windows. --- Telegram/SourceFiles/core/application.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index 5879f21f6..7ba879a82 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -1205,11 +1205,9 @@ void Application::closeWindow(not_null window) { void Application::closeChatFromWindows(not_null peer) { for (const auto &[history, window] : _secondaryWindows) { - if (!window) { - continue; - } if (history->peer == peer) { closeWindow(window.get()); + break; } else if (const auto session = window->sessionController()) { if (session->activeChatCurrent().peer() == peer) { session->showPeerHistory(