smeijer / leaflet-geosearch

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

TypeError: Cannot read property 'label' of undefined #258

Closed lucacassani closed 3 years ago

lucacassani commented 3 years ago

Hi, I use leaflet-geosearch^3.2.0 in my VueJs webapp with leaflet and vue2-leaflet modules. I added to my mapObject GeoSearchControl object with OpenStreetMapProvider (but this issue is present also with AlgoliaProvider). When I type in the search bar a location I get this issue: TypeError: Cannot read property 'label' of undefined.

In fact, as shown below,t.result is undefined .. I don't know why I have this issue but I think that t.label instead of t.result.label could solve it. Using resultFormat: ({ result }) => result.labelas option doesn't solve this issue since result is undefined. Thanks.

error

lucacassani commented 3 years ago

Downgraded to leaflet-geosearch@3.1.0 and no issues in this version!

smeijer commented 3 years ago

Thanks! Are you able to submit a pull request?

smeijer commented 3 years ago

This issue has been fixed in 3.2.1. Please let me know if it's still giving trouble.