From 71354d1611b47b7b1de7e622ae8a7490cd19625a Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 28 Dec 2022 23:37:16 +0400 Subject: [PATCH] Fix two crashes in own profile photo edit. --- Telegram/SourceFiles/ui/controls/userpic_button.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/ui/controls/userpic_button.cpp b/Telegram/SourceFiles/ui/controls/userpic_button.cpp index 9750290493..4a1bc4f075 100644 --- a/Telegram/SourceFiles/ui/controls/userpic_button.cpp +++ b/Telegram/SourceFiles/ui/controls/userpic_button.cpp @@ -91,7 +91,6 @@ void CameraBox( }, std::move(callback), track->frame(FrameRequest()).mirrored(true, false)); - box->closeBox(); }; box->setTitle(tr::lng_profile_camera_title()); @@ -274,10 +273,12 @@ void UserpicButton::choosePhotoLocally() { const auto user = _peer ? _peer->asUser() : nullptr; const auto name = (user && !user->firstName.isEmpty()) ? user->firstName - : _peer->name(); + : _peer + ? _peer->name() + : QString(); const auto phrase = (type == ChosenType::Suggest) ? &tr::lng_profile_suggest_sure - : (_peer->isUser() && !_peer->isSelf()) + : (user && !user->isSelf()) ? &tr::lng_profile_set_personal_sure : nullptr; PrepareProfilePhotoFromFile(