Skip to content

Commit b579815

Browse files
authored
Prevent crash if there is no matches in some case (#39)
1 parent 33330be commit b579815

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/AddressAutocomplete.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ const AddressAutocomplete = ({
117117
main_text_matched_substrings: matches
118118
}
119119
} = option;
120+
121+
if (!matches) return null
122+
120123
const parts = parse(
121124
option.structured_formatting.main_text,
122125
matches.map((match) => [match.offset, match.offset + match.length]),

0 commit comments

Comments
 (0)