Skip to content

Commit

Permalink
fix: handle empty value for select property (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamalexchip authored Jun 22, 2022
1 parent 6d79e97 commit d32e874
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Pages/Properties/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static function fromArray(array $array): self

$id = $array["id"] ?? null;
$name = $array["name"] ?? null;
$color = $array["color"];
$color = $array["color"] ?? self::COLOR_DEFAULT;

return new self($id, $name, $color);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Properties/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static function fromArray(array $array): self
/** @psalm-var SelectJson $array */
$property = Property::fromArray($array);

$option = Option::fromArray($array[self::TYPE]);
$option = Option::fromArray($array[self::TYPE] ?? []);

return new self($property, $option);
}
Expand Down

0 comments on commit d32e874

Please sign in to comment.