Added a check to make sure record exists before calling hasMethod on it.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@39190 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Hayden Smith 2007-07-24 03:44:03 +00:00
parent b785d359fa
commit 2f68028829
1 changed files with 1 additions and 1 deletions

View File

@ -19,7 +19,7 @@ class CheckboxSetField extends OptionsetField {
// Get values from the join, if available
if(is_object($this->form)) {
$record = $this->form->getRecord();
if(!$values && $record->hasMethod($this->name)) {
if(!$values && $record && $record->hasMethod($this->name)) {
$funcName = $this->name;
$join = $record->$funcName();
foreach($join as $joinItem) $values[] = $joinItem->ID;