From 7463a8fb05037b4872849b3eee9d3ac9cc493bdc Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 15 Sep 2007 21:09:13 +0000 Subject: [PATCH] elofgren:Display a useful error message if getCMSFields() returns null. Thanks Sam: http://www.silverstripe.com/general-discussion/flat/1537?showPost=2042#post2042 (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41942 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/CMSMain.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/CMSMain.php b/code/CMSMain.php index 64002d3d..cd5c0194 100644 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -279,6 +279,9 @@ JS; if($record->DeletedFromStage) $record->Status = _t('CMSMain.REMOVEDFD',"Removed from the draft site"); $fields = $record->getCMSFields($this); + if ($fields == null) { + user_error("getCMSFields returned null on a 'Page' object - it should return a FieldSet object. Perhaps you forgot to put a return statement at the end of your method?", E_USER_ERROR); + } $fields->push($idField = new HiddenField("ID")); $fields->push($liveURLField = new HiddenField("LiveURLSegment")); $fields->push($stageURLField = new HiddenField("StageURLSegment"));