Skip to content

Commit

Permalink
Fix race condition null pointer exception in unserializeBuckets
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Wojciechowski committed Apr 26, 2016
1 parent c74b834 commit 5d3efa9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions js/source/tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,14 @@ Tile.prototype = {
function unserializeBuckets(input, style) {
var output = {};
for (var i = 0; i < input.length; i++) {
var layer = style.getLayer(input[i].layerId);
if (!layer) continue;

var bucket = Bucket.create(util.extend({
childLayers: input[i].childLayerIds.map(style.getLayer.bind(style)),
layer: style.getLayer(input[i].layerId)
layer: layer,
childLayers: input[i].childLayerIds
.map(style.getLayer.bind(style))
.filter(function(layer) { return layer; })
}, input[i]));
output[bucket.id] = bucket;
}
Expand Down

0 comments on commit 5d3efa9

Please sign in to comment.