Do not call setMap(null) if control not in map
This commit is contained in:
+5
-2
@@ -830,8 +830,11 @@ ol.Map.prototype.requestRenderFrame = function() {
|
|||||||
ol.Map.prototype.removeControl = function(control) {
|
ol.Map.prototype.removeControl = function(control) {
|
||||||
var controls = this.getControls();
|
var controls = this.getControls();
|
||||||
goog.asserts.assert(goog.isDef(controls));
|
goog.asserts.assert(goog.isDef(controls));
|
||||||
control.setMap(null);
|
if (goog.isDef(controls.remove(control))) {
|
||||||
return /** @type {ol.control.Control|undefined} */ (controls.remove(control));
|
control.setMap(null);
|
||||||
|
return control;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user