diff --git a/Web/Models/Entities/Photo.php b/Web/Models/Entities/Photo.php index 57ab2b8a..b0ee2e83 100644 --- a/Web/Models/Entities/Photo.php +++ b/Web/Models/Entities/Photo.php @@ -336,7 +336,12 @@ class Photo extends Media public function getAlbum(): ?Album { - return (new Albums())->getAlbumByPhotoId($this); + $album = (new Albums())->getAlbumByPhotoId($this); + if (!$album || $album->isDeleted()) { + return null; + } + + return $album; } public function toVkApiStruct(bool $photo_sizes = true, bool $extended = false): object