perliedman / leaflet-control-geocoder

A simple geocoder form to locate places. Easily extended to multiple data providers.
http://www.liedman.net/leaflet-control-geocoder/
BSD 2-Clause "Simplified" License
567 stars 222 forks source link

Uncaught TypeError: Cannot read property 'length' of undefined (Mapbox) #254

Closed RobIsHere closed 5 years ago

RobIsHere commented 5 years ago

At for (var j = 0; j < loc.context.length; j++) { in https://github.com/perliedman/leaflet-control-geocoder/blob/master/src/geocoders/mapbox.js#L49

There's sometimes an error: Uncaught TypeError: Cannot read property 'length' of undefined

Maybe the for loop should just be wrapped in an if (loc.context){ ... } ?

It works in spite of this error