Browse Source

Avoid fatal error if the option is null

Thomas Rabaix 14 năm trước cách đây
mục cha
commit
e8dfbbbf74
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      Form/Type/AdminType.php

+ 4 - 0
Form/Type/AdminType.php

@@ -54,6 +54,10 @@ class AdminType extends AbstractType
      */
     public function getFieldDescription(array $options)
     {
+        if (!$options['field_description']) {
+            throw new \RuntimeException('Please provide a valid `field_description` option');
+        }
+
         return $options['field_description'];
     }