Skip features without geometry during canvas replay

Setting a feature geometry to null or undefined and triggering a hit
detection was throwing an exception.

This patch handles a batched feature without a geometry in the same
fashion as skipped features.
This commit is contained in:
Guillaume Beraudo
2015-08-04 18:08:54 +02:00
parent 85815a32a0
commit 23ae91cfd5

View File

@@ -252,7 +252,8 @@ ol.render.canvas.Replay.prototype.replay_ = function(
case ol.render.canvas.Instruction.BEGIN_GEOMETRY: case ol.render.canvas.Instruction.BEGIN_GEOMETRY:
feature = /** @type {ol.Feature} */ (instruction[1]); feature = /** @type {ol.Feature} */ (instruction[1]);
var featureUid = goog.getUid(feature).toString(); var featureUid = goog.getUid(feature).toString();
if (goog.isDef(skippedFeaturesHash[featureUid])) { if (goog.isDef(skippedFeaturesHash[featureUid]) ||
!goog.isDefAndNotNull(feature.getGeometry())) {
i = /** @type {number} */ (instruction[2]); i = /** @type {number} */ (instruction[2]);
} else if (goog.isDef(opt_hitExtent) && !ol.extent.intersects( } else if (goog.isDef(opt_hitExtent) && !ol.extent.intersects(
opt_hitExtent, feature.getGeometry().getExtent())) { opt_hitExtent, feature.getGeometry().getExtent())) {