mapbox / mapbox-gl-language

Switch language of your Mapbox GL JS style
https://mapbox.github.io/mapbox-gl-language/
BSD 3-Clause "New" or "Revised" License
198 stars 51 forks source link

Cannot read property 'split' of undefined #25

Closed ishitatsuyuki closed 3 years ago

ishitatsuyuki commented 6 years ago

I'm getting multiple error reports from Sentry, which tracks down to the following line:

https://github.com/mapbox/mapbox-gl-language/blob/c69b4da69ad1f7d1ec39dffa6e01038ab1222fb4/index.js#L198

All of them are reported from Chrome on Android, where the one with the newest version is running Chrome 62.

andrewharvey commented 6 years ago

I guess it should have a fallback that if it can't get navigator.languages, navigator.language or navigator.userLanguage it should just return null.

andrewharvey commented 6 years ago

BTW. I tested this on Chrome on Android, 69 and I can't replicate, but I still agree with being more defensive in the code.