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(