diff --git a/.github/workflows/npm-module-release.yml b/.github/workflows/npm-module-release.yml index 5791265..6c55873 100644 --- a/.github/workflows/npm-module-release.yml +++ b/.github/workflows/npm-module-release.yml @@ -8,7 +8,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: '16.x' + node-version: '20.x' registry-url: 'https://registry.npmjs.org' - name: Publish run: | diff --git a/.gitignore b/.gitignore index b0de03a..409813c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules .eslintcache +.idea diff --git a/package-lock.json b/package-lock.json index a6850da..8394a9a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "treetracker-web-map-core", - "version": "2.7.2", + "version": "2.7.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "treetracker-web-map-core", - "version": "2.7.2", + "version": "2.7.3", "license": "ISC", "dependencies": { "axios": "^0.24.0", diff --git a/src/Map.js b/src/Map.js index 0fdb95d..1431f5c 100644 --- a/src/Map.js +++ b/src/Map.js @@ -406,12 +406,12 @@ export default class Map { } async _unloadTileServer() { - if (this.map.hasLayer(this.layerTile)) { + if (this.layerTile && this.map.hasLayer(this.layerTile)) { this.map.removeLayer(this.layerTile) } else { log.warn('try to remove nonexisting tile layer') } - if (this.map.hasLayer(this.layerUtfGrid)) { + if (this.layerUtfGrid && this.map.hasLayer(this.layerUtfGrid)) { this.map.removeLayer(this.layerUtfGrid) } else { log.warn('try to remove nonexisting grid layer') @@ -593,7 +593,7 @@ export default class Map { this.layerSelected?.payload, ) - if (this.map.hasLayer(this.layerSelected)) { + if (this.layerSelected && this.map.hasLayer(this.layerSelected)) { this.map.removeLayer(this.layerSelected) } else { log.warn('try to remove nonexisting layer selected')