Fix crash in profile photo privacy edition.

Fixes #25645.
This commit is contained in:
John Preston 2023-01-02 10:08:32 +04:00
parent af69a7a01f
commit 3c4cf2862b
1 changed files with 4 additions and 3 deletions

View File

@ -1163,9 +1163,10 @@ object_ptr<Ui::RpWidget> ProfilePhotoPrivacyController::setupBelowWidget(
_saveAdditional = [=] {
if (removeButton->isHidden()) {
const auto photoId = SyncUserFallbackPhotoViewer(self);
if (const auto photo = self->owner().photo(*photoId)) {
controller->session().api().peerPhoto().clear(photo);
if (const auto photoId = SyncUserFallbackPhotoViewer(self)) {
if (const auto photo = self->owner().photo(*photoId)) {
controller->session().api().peerPhoto().clear(photo);
}
}
} else if (!state->localOriginal.isNull()) {
controller->session().api().peerPhoto().uploadFallback(