From db4c86a4f4c64941e236fd7e01cbcde218d78bb4 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Mon, 2 Oct 2023 16:14:20 -0700 Subject: [PATCH 1/2] Filter null field options before attempting to process them --- app/Models/Labels/Field.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 +} From e82fec2a5f987a57770a077632707a00906aae92 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Mon, 2 Oct 2023 16:19:20 -0700 Subject: [PATCH 2/2] Grammar fix --- app/Models/Labels/Field.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Labels/Field.php b/app/Models/Labels/Field.php index fcc5db0dc7..c023f54175 100644 --- a/app/Models/Labels/Field.php +++ b/app/Models/Labels/Field.php @@ -21,7 +21,7 @@ class Field { public static function makeArray(Field $field, Asset $asset) { return $field->getOptions() - // filter out any null accidental FieldOptions + // filter out any FieldOptions that are accidentally null ->filter() ->map(fn($option) => $option->toArray($asset)) ->filter(fn($result) => $result['value'] != null);