]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/PageRevisionController.php
Tiny header
[bookstack] / app / Http / Controllers / PageRevisionController.php
index d595a6e26fd797cb0c7693f473e0680a168caf3e..c6a4926d28b88b87c3caed0a32f97d377f339788 100644 (file)
@@ -124,11 +124,8 @@ class PageRevisionController extends Controller
             throw new NotFoundException("Revision #{$revId} not found");
         }
 
-        // Get the current revision for the page
-        $currentRevision = $page->getCurrentRevision();
-
-        // Check if its the latest revision, cannot delete latest revision.
-        if (intval($currentRevision->id) === intval($revId)) {
+        // Check if it's the latest revision, cannot delete the latest revision.
+        if (intval($page->currentRevision->id ?? null) === intval($revId)) {
             $this->showErrorNotification(trans('entities.revision_cannot_delete_latest'));
 
             return redirect($page->getUrl('/revisions'));