summaryrefslogtreecommitdiff
path: root/core/models/item.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/models/item.php')
-rw-r--r--core/models/item.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/models/item.php b/core/models/item.php
index 0f6e16e8..fbaca0e7 100644
--- a/core/models/item.php
+++ b/core/models/item.php
@@ -42,10 +42,13 @@ class Item_Model extends ORM_MPTT {
public function delete() {
$path = $this->file_path();
parent::delete();
- if ($this->is_album()) {
- dir::unlink($path);
- } else {
- unlink($path);
+ // If there is no name, the path is invalid so don't try to delete
+ if (!empty($this->name)) {
+ if ($this->is_album()) {
+ dir::unlink($path);
+ } else {
+ unlink($path);
+ }
}
}