Skip to content

Commit

Permalink
Merge pull request #9 from ericdong79/dev/fix-possible-source-undefined
Browse files Browse the repository at this point in the history
fix: error if source is undefined
  • Loading branch information
rowanwins committed Jun 13, 2023
2 parents ebd0813 + 55597f8 commit 8f826a4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,13 @@ export default class FeatureService {
}

_updateFcOnMap(fc) {
this._map.getSource(this.sourceId).setData(fc)
const source = this._map.getSource(this.sourceId);
if(source){
source.setData(fc)
}
else{
console.warn(`Cannot find source with id: ${this.sourceId}`)
}
}

_doesTileOverlapBbox(tile, bbox) {
Expand Down

0 comments on commit 8f826a4

Please sign in to comment.