Fix for deleting photos that don't have albums

This commit is contained in:
lalka2018 2023-10-11 18:21:30 +03:00
parent a859fa13a5
commit ab1c6dc843

View file

@ -336,7 +336,10 @@ final class PhotosPresenter extends OpenVKPresenter
if(is_null($this->user) || $this->user->id != $ownerId)
$this->flashFail("err", tr("error_access_denied_short"), tr("error_access_denied"));
$redirect = $photo->getAlbum()->getOwner() instanceof User ? "/id0" : "/club" . $ownerId;
if(!is_null($album = $photo->getAlbum()))
$redirect = $album->getOwner() instanceof User ? "/id0" : "/club" . $ownerId;
else
$redirect = "/id0";
$photo->isolate();
$photo->delete();