]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Tools/TrashCan.php
Added test for logical-theme-system command registration
[bookstack] / app / Entities / Tools / TrashCan.php
index 8327c948931b5567e80fc3d6ca5728c82533fa87..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);
         }