Skip to content

Commit

Permalink
Prevent crash if there is no matches in some case (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylchauf authored Jun 24, 2024
1 parent 33330be commit b579815
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/AddressAutocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ const AddressAutocomplete = ({
main_text_matched_substrings: matches
}
} = option;

if (!matches) return null

const parts = parse(
option.structured_formatting.main_text,
matches.map((match) => [match.offset, match.offset + match.length]),
Expand Down

0 comments on commit b579815

Please sign in to comment.