Skip to content

Commit

Permalink
add condition to verify map-geometry is legit
Browse files Browse the repository at this point in the history
  • Loading branch information
AliyanH committed Mar 27, 2024
1 parent 9f39586 commit 18ba67e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/map-feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ export class MapFeature extends HTMLElement {
if (!this.querySelector('map-geometry')) return;
let fallbackCS = this._getFallbackCS();
let content = parentLayer.src ? parentLayer.shadowRoot : parentLayer;
this._geometry = layerToAddTo.createGeometry(this, fallbackCS); // side effect: extends `this` with this._groupEl, points to svg g element that renders to map SD
this._geometry = layerToAddTo.createGeometry(this, fallbackCS); // side effect: extends `this` with this._groupEl if successful, points to svg g element that renders to map SD
if (!this._geometry) return;
layerToAddTo.addLayer(this._geometry);
this._setUpEvents();
}
Expand Down
2 changes: 1 addition & 1 deletion src/mapml/layers/FeatureLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ export var FeatureLayer = L.FeatureGroup.extend({
options.zoomBounds = feature.extent.zoom;
}
let geometry = this._geometryToLayer(feature, options, cs, +zoom, title);
if (geometry) {
if (geometry && Object.keys(geometry._layers).length !== 0) {
// if the layer is being used as a query handler output, it will have
// a color option set. Otherwise, copy classes from the feature
if (!geometry.options.color && feature.hasAttribute('class')) {
Expand Down

0 comments on commit 18ba67e

Please sign in to comment.