From 107b72f44251ede68c2946089e50116602392aac Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 5 Sep 2023 21:31:45 +0400 Subject: [PATCH] Fix possible crash in AddBotToGroupBox. --- Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp index 6e205cb84..d867c0607 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp @@ -384,8 +384,11 @@ void EditAdminBox::prepare() { if (!_saveCallback) { return; } else if (_addAsAdmin && !_addAsAdmin->checked()) { + const auto weak = Ui::MakeWeak(this); AddBotToGroup(user(), peer(), _addingBot->token); - getDelegate()->hideLayer(); + if (const auto strong = weak.data()) { + strong->closeBox(); + } return; } else if (_addingBot && !_addingBot->existing) { const auto phrase = peer()->isBroadcast()