Skip to content

Commit

Permalink
Merge pull request #6 from bcash/main
Browse files Browse the repository at this point in the history
Fixes error thrown if administrative_area_level_2 is missing in search result
  • Loading branch information
andreia authored Oct 27, 2024
2 parents 815b8d1 + 9db5391 commit cc28cfb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Forms/Components/GoogleAutocomplete.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ public function getChildComponents(): array
if (str_contains($googleFieldName, '{')) {
$value = $this->replaceFieldPlaceholders($googleFieldName, $googleFields, $googleFieldValue);
} else {
$value = $googleFields[$googleFieldName][$googleFieldValue] ?: '';
// bc: Fixes issue with Carson City, NV. No administrative_area_level_2 provided in search result.
$value = '';
if (isset($googleFields[$googleFieldName][$googleFieldValue])) {
$value = $googleFields[$googleFieldName][$googleFieldValue] ?: '';
}
}

$set($field->getName(), $value);
Expand Down

0 comments on commit cc28cfb

Please sign in to comment.