From 85634d4c3badc2d3827fce7e989e4fdd904ad5f0 Mon Sep 17 00:00:00 2001 From: Ante Drnasin Date: Mon, 2 Apr 2018 14:36:32 +0200 Subject: [PATCH] Update admin.php Fix for https://github.com/getgrav/grav-plugin-admin/issues/1408 --- admin.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/admin.php b/admin.php index f973457bb..506152621 100644 --- a/admin.php +++ b/admin.php @@ -792,11 +792,13 @@ public function onAdminAfterSave(Event $event) { // Special case to redirect after changing the admin route to avoid 'breaking' $obj = $event['object']; - $blueprint = $obj->blueprints()->getFilename(); + if (!is_null($event['object'])) { + $blueprint = $obj->blueprints()->getFilename(); - if ($blueprint == 'admin/blueprints' && isset($obj->route) && $this->admin_route !== $obj->route) { - $redirect = preg_replace('/^' . str_replace('/','\/',$this->admin_route) . '/',$obj->route,$this->uri->path()); - $this->grav->redirect($redirect); + if ($blueprint == 'admin/blueprints' && isset($obj->route) && $this->admin_route !== $obj->route) { + $redirect = preg_replace('/^' . str_replace('/','\/',$this->admin_route) . '/',$obj->route,$this->uri->path()); + $this->grav->redirect($redirect); + } } }