Fix VectorSource isEmpty without spatial index

This commit is contained in:
Maximilian Krög
2022-02-13 00:08:24 +01:00
parent 9bfb0c1b9d
commit e2c9f62cc6
+9 -1
View File
@@ -941,7 +941,15 @@ class VectorSource extends Source {
* @return {boolean} Is empty. * @return {boolean} Is empty.
*/ */
isEmpty() { 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;
} }
/** /**