From 3f0078cfbf7113143b32791363bff21d9894ee34 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 26 Jun 2020 15:48:38 +0400 Subject: [PATCH] Fix crash in float player over Intro. --- .../media/player/media_player_instance.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/media/player/media_player_instance.cpp b/Telegram/SourceFiles/media/player/media_player_instance.cpp index e5c5bebf9..65854cf6e 100644 --- a/Telegram/SourceFiles/media/player/media_player_instance.cpp +++ b/Telegram/SourceFiles/media/player/media_player_instance.cpp @@ -227,8 +227,12 @@ void Instance::clearStreamed(not_null data, bool savePosition) { data->streamed = nullptr; _roundPlaying = false; - App::wnd()->sessionController()->disableGifPauseReason( - Window::GifPauseReason::RoundPlaying); + if (const auto window = App::wnd()) { + if (const auto controller = window->sessionController()) { + controller->disableGifPauseReason( + Window::GifPauseReason::RoundPlaying); + } + } } void Instance::refreshPlaylist(not_null data) { @@ -745,8 +749,12 @@ void Instance::handleStreamingUpdate( requestRoundVideoRepaint(); }); _roundPlaying = true; - App::wnd()->sessionController()->enableGifPauseReason( - Window::GifPauseReason::RoundPlaying); + if (const auto window = App::wnd()) { + if (const auto controller = window->sessionController()) { + controller->enableGifPauseReason( + Window::GifPauseReason::RoundPlaying); + } + } requestRoundVideoResize(); } emitUpdate(data->type);