diff --git a/src/ol/Collection.js b/src/ol/Collection.js index 15c51f866b..5b562c05a5 100644 --- a/src/ol/Collection.js +++ b/src/ol/Collection.js @@ -254,6 +254,9 @@ class Collection extends BaseObject { * @api */ removeAt(index) { + if (index < 0 || index >= this.getLength()) { + return undefined; + } const prev = this.array_[index]; this.array_.splice(index, 1); this.updateLength_();