Fix crash in channel setup box.

This commit is contained in:
John Preston 2018-12-03 10:41:34 +04:00
parent 684ce09bb5
commit 1b19e870c0

View File

@ -773,26 +773,25 @@ void SetupChannelBox::updateSelected(const QPoint &cursorGlobalPosition) {
}
void SetupChannelBox::save() {
if (_privacyGroup->value() == Privacy::Private) {
if (_saveRequestId) {
return;
} else if (_privacyGroup->value() == Privacy::Private) {
if (_existing) {
_sentUsername = QString();
_saveRequestId = MTP::send(MTPchannels_UpdateUsername(_channel->inputChannel, MTP_string(_sentUsername)), rpcDone(&SetupChannelBox::onUpdateDone), rpcFail(&SetupChannelBox::onUpdateFail));
} else {
closeBox();
}
} else {
const auto link = _link->text().trimmed();
if (link.isEmpty()) {
_link->setFocus();
_link->showError();
return;
}
_sentUsername = link;
_saveRequestId = MTP::send(MTPchannels_UpdateUsername(_channel->inputChannel, MTP_string(_sentUsername)), rpcDone(&SetupChannelBox::onUpdateDone), rpcFail(&SetupChannelBox::onUpdateFail));
}
if (_saveRequestId) return;
QString link = _link->text().trimmed();
if (link.isEmpty()) {
_link->setFocus();
_link->showError();
return;
}
_sentUsername = link;
_saveRequestId = MTP::send(MTPchannels_UpdateUsername(_channel->inputChannel, MTP_string(_sentUsername)), rpcDone(&SetupChannelBox::onUpdateDone), rpcFail(&SetupChannelBox::onUpdateFail));
}
void SetupChannelBox::handleChange() {