smeijer / leaflet-geosearch

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

fix the runtime error due to accessing non-initialized this.results in src/resultList.js #178

Closed j-devel closed 4 years ago

j-devel commented 6 years ago

The error happens when ENTER key is pressed in the search bar before resultList.render() is called. This patch prevents resultList.select(index) from being called when the selected result's index is -1 (i.e. when the result item is not selected yet).

How to reproduce the error:

  1. Open https://smeijer.github.io/leaflet-geosearch/#openstreetmap
  2. Open dev console.
  3. Focus on the search bar input and press Enter key. error-reproduction-leaflet-geosearch
smeijer commented 4 years ago

I've closed this one, as I can't reproduce this bug in the current version. It might have been fixed in another PR. #200 maybe?