Skip to content

A free open source IT asset/license management system

Filter null field options before attempting to process them

Marcus Mooredb4c86a4f4c6
diff --git a/app/Models/Labels/Field.php b/app/Models/Labels/Field.php
index b264c7ac29..fcc5db0dc7 100644
--- a/app/Models/Labels/Field.php
+++ b/app/Models/Labels/Field.php
@@ -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;
}
-}
\ No newline at end of file
+}