Filter null field options before attempting to process them

This commit is contained in:
Marcus Moore 2023-10-02 16:14:20 -07:00
parent 1abcc8b802
commit db4c86a4f4

View file

@ -21,6 +21,8 @@ class Field {
public static function makeArray(Field $field, Asset $asset) {
return $field->getOptions()
// filter out any null accidental FieldOptions
->filter()
->map(fn($option) => $option->toArray($asset))
->filter(fn($result) => $result['value'] != null);
}
@ -36,4 +38,4 @@ class Field {
->map(fn($optionString) => FieldOption::fromString($optionString));
return $field;
}
}
}