mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
b785d359fa
commit
2f68028829
@ -19,7 +19,7 @@ class CheckboxSetField extends OptionsetField {
|
|||||||
// Get values from the join, if available
|
// Get values from the join, if available
|
||||||
if(is_object($this->form)) {
|
if(is_object($this->form)) {
|
||||||
$record = $this->form->getRecord();
|
$record = $this->form->getRecord();
|
||||||
if(!$values && $record->hasMethod($this->name)) {
|
if(!$values && $record && $record->hasMethod($this->name)) {
|
||||||
$funcName = $this->name;
|
$funcName = $this->name;
|
||||||
$join = $record->$funcName();
|
$join = $record->$funcName();
|
||||||
foreach($join as $joinItem) $values[] = $joinItem->ID;
|
foreach($join as $joinItem) $values[] = $joinItem->ID;
|
||||||
|
Loading…
Reference in New Issue
Block a user