diff --git a/src/ol/source/Vector.js b/src/ol/source/Vector.js index aed90d7369..c367084f21 100644 --- a/src/ol/source/Vector.js +++ b/src/ol/source/Vector.js @@ -941,7 +941,15 @@ class VectorSource extends Source { * @return {boolean} Is empty. */ isEmpty() { - return this.featuresRtree_.isEmpty() && isEmpty(this.nullGeometryFeatures_); + if (this.featuresRtree_) { + return ( + this.featuresRtree_.isEmpty() && isEmpty(this.nullGeometryFeatures_) + ); + } + if (this.featuresCollection_) { + return this.featuresCollection_.getLength() === 0; + } + return true; } /**