diff --git a/lib/Artwork.php b/lib/Artwork.php index acb3c1e5..ce007d9b 100644 --- a/lib/Artwork.php +++ b/lib/Artwork.php @@ -509,18 +509,15 @@ class Artwork{ } // Check for existing `Artwork` objects with the same URL but different `ArtworkID`s. - if(isset($this->ArtworkId)){ - try{ - $existingArtwork = Artwork::GetByUrl($this->Artist->UrlName, $this->UrlName); - if($existingArtwork->ArtworkId != $this->ArtworkId){ - // Duplicate found, alert the user. - $error->Add(new Exceptions\ArtworkAlreadyExistsException()); - } - } - catch(Exceptions\ArtworkNotFoundException){ - // No duplicates found, continue. + try{ + $existingArtwork = Artwork::GetByUrl($this->Artist->UrlName, $this->UrlName); + if(!isset($this->ArtworkId) || $existingArtwork->ArtworkId != $this->ArtworkId){ + $error->Add(new Exceptions\ArtworkAlreadyExistsException()); } } + catch(Exceptions\ArtworkNotFoundException){ + // No duplicates found, continue. + } if($isImageRequired){ if($imagePath === null){