Fix possible crash in AddBotToGroupBox.

This commit is contained in:
John Preston 2023-09-05 21:31:45 +04:00
parent 8adbbe6885
commit 107b72f442
1 changed files with 4 additions and 1 deletions

View File

@ -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()