Skip to content

Commit ea312ea

Browse files
committed
fix: defend null drawtoolLayer in Measure3DTool
1 parent 15ffd1a commit ea312ea

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/gl/src/analysis/Measure3DTool.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ export default class Measure3DTool extends maptalks.DrawTool {
6363

6464
_addHelperLayer() {
6565
const id = maptalks.INTERNAL_LAYER_PREFIX + 'drawtool';
66-
this._map.getLayer(id).hide();
66+
const drawtoolLayer = this._map.getLayer(id);
67+
if (drawtoolLayer) {
68+
drawtoolLayer.hide();
69+
}
6770
}
6871

6972
_afterEnable() {

0 commit comments

Comments
 (0)