From 6bdb807af1272c22141e83b7672788b95c4dd458 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Fri, 15 May 2009 01:05:44 +0000 Subject: [PATCH] BUGFIX Fixed potential non-object error in LeftAndMain::callPageMethod() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@76930 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/LeftAndMain.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 8e63a507..bf583529 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -779,6 +779,7 @@ JS; $parentID = 0; } $_REQUEST['ajax'] = 1; + $cleanupJS = ''; if(is_numeric($id) && is_numeric($parentID) && $id != $parentID) { $node = DataObject::get_by_id($this->stat('tree_class'), $id); @@ -1103,8 +1104,10 @@ JS; */ function callPageMethod($data, $form) { $methodName = $form->buttonClicked()->extraData(); - $record = $this->CurrentPage(); - return $record->$methodName($data, $form); + $record = $this->currentPage(); + if(!$record) return false; + + return $record->$methodName($data, $form); } /**