Improve error handling on invalid model attributes being used for form fields

This commit is contained in:
Luke Towers 2020-02-13 16:48:39 -06:00
parent a68f3abf1c
commit 136fd53109
1 changed files with 3 additions and 0 deletions

View File

@ -1294,6 +1294,9 @@ class Form extends WidgetBase
if (!is_array($fieldOptions) && !$fieldOptions) {
try {
list($model, $attribute) = $field->resolveModelAttribute($this->model, $field->fieldName);
if (!$model) {
throw new Exception();
}
}
catch (Exception $ex) {
throw new ApplicationException(Lang::get('backend::lang.field.options_method_invalid_model', [