Skip to content

Commit

Permalink
Fix for deleting photos that don't have albums
Browse files Browse the repository at this point in the history
  • Loading branch information
mrilyew committed Oct 11, 2023
1 parent a859fa1 commit ab1c6dc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Web/Presenters/PhotosPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,10 @@ function renderDeletePhoto(int $ownerId, int $photoId): void
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();
Expand Down

0 comments on commit ab1c6dc

Please sign in to comment.