mapbox / mapbox-gl-geocoder

Geocoder control for mapbox-gl-js using Mapbox Geocoding API
https://mapbox.com/mapbox-gl-js/example/mapbox-gl-geocoder/
ISC License
362 stars 181 forks source link

Potential `null` dereference in `onRemove()` #480

Open angrytongan opened 1 year ago

angrytongan commented 1 year ago

It's possible that parentNode is null, which causes a null dereference:

https://github.com/mapbox/mapbox-gl-geocoder/blob/5ac5826bd8e51fd6219bb269a4cc2bba0ac4902d/lib/index.js#L395

This can occur if the geocoder adds itself to a map, then map.remove() is called, and then the geocoder tries to remove itself from the map.