Skip to content

Commit

Permalink
fix TypeError thrown when Map.querySourceFeatures doesn't include a p…
Browse files Browse the repository at this point in the history
…arameters option
  • Loading branch information
andrewharvey committed Nov 4, 2016
1 parent 358cabe commit d99504e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/source/tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class Tile {

if (!layer) return;

const filter = featureFilter(params.filter);
const filter = featureFilter(params && params.filter);
const coord = { z: this.coord.z, x: this.coord.x, y: this.coord.y };

for (let i = 0; i < layer.length; i++) {
Expand Down
3 changes: 3 additions & 0 deletions test/js/source/tile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ test('querySourceFeatures', (t) => {
geojsonWrapper.name = '_geojsonTileLayer';
tile.rawTileData = vtpbf({ layers: { '_geojsonTileLayer': geojsonWrapper }});

result = [];
tile.querySourceFeatures(result);
t.equal(result.length, 1);
result = [];
tile.querySourceFeatures(result, {});
t.equal(result.length, 1);
Expand Down

0 comments on commit d99504e

Please sign in to comment.