From 9f2903f81d7419cb6b8a5b74d39ce0e0503152e9 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 9 Dec 2020 14:48:07 +0400 Subject: [PATCH] Fix crash in one-on-one calls. --- Telegram/SourceFiles/calls/calls_top_bar.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/calls/calls_top_bar.cpp b/Telegram/SourceFiles/calls/calls_top_bar.cpp index 30ba5d18fa..c868975649 100644 --- a/Telegram/SourceFiles/calls/calls_top_bar.cpp +++ b/Telegram/SourceFiles/calls/calls_top_bar.cpp @@ -355,6 +355,11 @@ void TopBar::initControls() { } void TopBar::initBlobs() { + const auto group = _groupCall.get(); + if (!group) { + return; + } + const auto &hideDuration = kBlobLevelDuration1 * 2; const auto hideLastTime = _blobs->lifetime().make_state(0); const auto lastTime = _blobs->lifetime().make_state(0); @@ -374,7 +379,7 @@ void TopBar::initBlobs() { return true; }); - _groupCall->stateValue( + group->stateValue( ) | rpl::start_with_next([=](Calls::GroupCall::State state) { if (state == Calls::GroupCall::State::HangingUp) { _blobs->hide(); @@ -384,7 +389,7 @@ void TopBar::initBlobs() { auto hideBlobs = rpl::combine( rpl::single(anim::Disabled()) | rpl::then(anim::Disables()), Core::App().appDeactivatedValue(), - _groupCall->stateValue( + group->stateValue( ) | rpl::map([](Calls::GroupCall::State state) { using State = Calls::GroupCall::State; if (state != State::Creating @@ -471,7 +476,7 @@ void TopBar::initBlobs() { }); }, lifetime()); - _groupCall->levelUpdates( + group->levelUpdates( ) | rpl::filter([=](const LevelUpdate &update) { return !*hideLastTime && (update.value > _blobsLastLevel); }) | rpl::start_with_next([=](const LevelUpdate &update) {