Unify return statement

Only return the callback result if it is truthy,
otherwise return undefined.
This commit is contained in:
tsauerwein
2015-01-08 15:11:38 +01:00
parent 35c58b3b0e
commit 25612f1af2
2 changed files with 9 additions and 3 deletions

View File

@@ -764,7 +764,13 @@ ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayAll_ =
gl.drawElements(goog.webgl.TRIANGLES, numItems, elementType, offsetInBytes);
start = end;
}
return featureCallback(null);
var result = featureCallback(null);
if (result) {
return result;
} else {
return undefined;
}
};
@@ -1160,7 +1166,7 @@ ol.render.webgl.ReplayGroup.prototype.hasFeatureAtPixel = function(
return imageData[3] > 0;
}, false);
return goog.isDef(hasFeature) ? hasFeature : false;
return goog.isDef(hasFeature);
};