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
This commit is contained in:
Sean Harvey 2009-05-15 01:05:44 +00:00 committed by Sam Minnee
parent 6c3a3677fe
commit 6bdb807af1

View File

@ -779,6 +779,7 @@ JS;
$parentID = 0; $parentID = 0;
} }
$_REQUEST['ajax'] = 1; $_REQUEST['ajax'] = 1;
$cleanupJS = '';
if(is_numeric($id) && is_numeric($parentID) && $id != $parentID) { if(is_numeric($id) && is_numeric($parentID) && $id != $parentID) {
$node = DataObject::get_by_id($this->stat('tree_class'), $id); $node = DataObject::get_by_id($this->stat('tree_class'), $id);
@ -1103,8 +1104,10 @@ JS;
*/ */
function callPageMethod($data, $form) { function callPageMethod($data, $form) {
$methodName = $form->buttonClicked()->extraData(); $methodName = $form->buttonClicked()->extraData();
$record = $this->CurrentPage(); $record = $this->currentPage();
return $record->$methodName($data, $form); if(!$record) return false;
return $record->$methodName($data, $form);
} }
/** /**