Do not call setMap(null) if control not in map

This commit is contained in:
Éric Lemoine
2013-06-20 16:10:11 +02:00
parent be86b83b67
commit b0dde2ecb4

View File

@@ -830,8 +830,11 @@ ol.Map.prototype.requestRenderFrame = function() {
ol.Map.prototype.removeControl = function(control) {
var controls = this.getControls();
goog.asserts.assert(goog.isDef(controls));
control.setMap(null);
return /** @type {ol.control.Control|undefined} */ (controls.remove(control));
if (goog.isDef(controls.remove(control))) {
control.setMap(null);
return control;
}
return undefined;
};