]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Tools/TrashCan.php
Update verify-totp.blade.php
[bookstack] / app / Entities / Tools / TrashCan.php
index 82569278e121915f546960a70a5dbc1faf44488a..fcf933726d2e0b6d8320ef0e9b72ab07b989dbc3 100644 (file)
@@ -235,13 +235,15 @@ class TrashCan
     {
         $shouldRestore = true;
         $restoreCount = 0;
-        $parent = $deletion->deletable->getParent();
 
-        if ($parent && $parent->trashed()) {
-            $shouldRestore = false;
+        if ($deletion->deletable instanceof Entity) {
+            $parent = $deletion->deletable->getParent();
+            if ($parent && $parent->trashed()) {
+                $shouldRestore = false;
+            }
         }
 
-        if ($shouldRestore) {
+        if ($deletion->deletable instanceof Entity && $shouldRestore) {
             $restoreCount = $this->restoreEntity($deletion->deletable);
         }
 
@@ -323,6 +325,8 @@ class TrashCan
         if ($entity instanceof Bookshelf) {
             return $this->destroyShelf($entity);
         }
+
+        return 0;
     }
 
     /**