diff --git a/code/ImageGalleryAlbum.php b/code/ImageGalleryAlbum.php index ae2e9f6..3440be2 100644 --- a/code/ImageGalleryAlbum.php +++ b/code/ImageGalleryAlbum.php @@ -75,11 +75,11 @@ function onBeforeDelete() { parent::onBeforeDelete(); $this->GalleryItems()->removeAll(); - $this->Folder()->delete(); + if($this->Folder()->ID) $this->Folder()->delete(); } } -?> \ No newline at end of file +?> diff --git a/code/ImageGalleryPage.php b/code/ImageGalleryPage.php index a346b0f..c06e1ed 100644 --- a/code/ImageGalleryPage.php +++ b/code/ImageGalleryPage.php @@ -78,7 +78,7 @@ function onBeforeDelete() $album->delete(); } } - $this->RootFolder()->delete(); // delete root folder of ImageGalleryPage + if($this->RootFolder()->ID) $this->RootFolder()->delete(); // delete root folder of ImageGalleryPage } parent::onBeforeDelete();