Skip to content

Commit 01c2a0e

Browse files
committed
Merge pull request #126 from kufi/patch-5
Fixed null pointer error
2 parents 95d4ce9 + a593098 commit 01c2a0e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Form/EventListener/SingleUploadSubscriber.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ public function preSetData(FormEvent $event)
3333
{
3434
$form = $event->getForm();
3535
$obj = $event->getData();
36+
37+
//can be null if prototype in collection
38+
if($obj == null) {
39+
return;
40+
}
41+
3642
foreach ($form->all() as $child) {
37-
if ($child->getConfig()->getType()->getName() === 'afe_single_upload') {
43+
if ($this->isFieldSingleUpload($child->getConfig()->getType())) {
3844
$name = $child->getName();
3945
$getterName = 'get'.ucfirst($name);
4046
$this->files[$name] = $obj->$getterName();

0 commit comments

Comments
 (0)