BUGFIX If DropdownField->Field() lack of source checking before looping through it

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64320 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-10-15 23:25:55 +00:00
parent 5865fd19d1
commit 972558df3f

View File

@ -70,6 +70,7 @@ class DropdownField extends FormField {
$options = ''; $options = '';
$source = $this->getSource(); $source = $this->getSource();
if($source) {
foreach($source as $value => $title) { foreach($source as $value => $title) {
$selected = ($value == $this->value) ? 'selected' : null; $selected = ($value == $this->value) ? 'selected' : null;
if($selected && $this->value != 0) { if($selected && $this->value != 0) {
@ -85,6 +86,7 @@ class DropdownField extends FormField {
$title $title
); );
} }
}
$attributes = array( $attributes = array(
'class' => trim($this->extraClass()) ? $this->extraClass() : null, 'class' => trim($this->extraClass()) ? $this->extraClass() : null,