smeijer / leaflet-geosearch

A geocoding/address-lookup library supporting various api providers.
https://smeijer.github.io/leaflet-geosearch/
MIT License
1.03k stars 273 forks source link

Stop enter key triggering TypeError in search box (issue #181) #200

Closed deadbeef404 closed 5 years ago

deadbeef404 commented 5 years ago

This bug is triggered by typing a word and hitting enter before the AJAX request returns (depends on internet connection speed).

This fixes the TypeError raised when the results list is still undefined. this.results isn't initialised with a default value. When an enter key is hit within a search box, it triggers the select method (even if there are no results to select). When select references this.results, it's still undefined.

smeijer commented 5 years ago

Thanks 👍