From d2944d8402ff2a50b89b492bf154efdeb2fa31f3 Mon Sep 17 00:00:00 2001 From: Aaron Carlino Date: Wed, 18 May 2016 13:41:54 +1200 Subject: [PATCH] BUGFIX: Ensure array before setByIDList() --- code/FileAttachmentField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/FileAttachmentField.php b/code/FileAttachmentField.php index c08291a..60258da 100644 --- a/code/FileAttachmentField.php +++ b/code/FileAttachmentField.php @@ -210,7 +210,7 @@ public function saveInto(DataObjectInterface $record) { } } - if($relation = $this->getRelation()) { + if(($relation = $this->getRelation()) && is_array($this->Value())) { $relation->setByIDList($this->Value()); } elseif($record->has_one($fieldname)) { $record->{"{$fieldname}ID"} = $this->Value() ?: 0;