Skip to content

Commit 55597f8

Browse files
committed
fix: error if source is undefined
1 parent ebd0813 commit 55597f8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,13 @@ export default class FeatureService {
302302
}
303303

304304
_updateFcOnMap(fc) {
305-
this._map.getSource(this.sourceId).setData(fc)
305+
const source = this._map.getSource(this.sourceId);
306+
if(source){
307+
source.setData(fc)
308+
}
309+
else{
310+
console.warn(`Cannot find source with id: ${this.sourceId}`)
311+
}
306312
}
307313

308314
_doesTileOverlapBbox(tile, bbox) {

0 commit comments

Comments
 (0)