IITC-CE / Leaflet.Canvas-Markers

Leaflet plugin for displaying icons on canvas instead of DOM
MIT License
2 stars 4 forks source link

self._markers not defined in addMarkers. #13

Closed jackdh closed 4 years ago

jackdh commented 4 years ago

In addMarker you do the following checks

    if (!self._markers) self._markers = new rbush();

    //_latlngMarkers contains Lat\Long coordinates of all markers in layer.
    if (!self._latlngMarkers) {
      self._latlngMarkers = new rbush();
      self._latlngMarkers.dirty = 0;
      self._latlngMarkers.total = 0;
    }

if you call addMarkers with an empty list, this will cause an error here: self._markers.load(tmpMark);

We can either return early if you find an empty list or perform the creation / check at the top of addMarkers. Thoughts?

johnd0e commented 4 years ago

Hi. Before we continue: have you noticed that current dev branch is getevents? https://github.com/Spaction/Leaflet.Canvas-Markers/pull/3