Skip to content

Commit b102929

Browse files
committed
fix: unlisten only when possible
1 parent 63f1bd0 commit b102929

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/control/modify.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ class ModifyControl extends Control {
393393
*/
394394
addListeners() {
395395
this.removeListeners();
396-
this.map.on('pointermove', this.cursorHandler);
396+
this.map?.on('pointermove', this.cursorHandler);
397397
}
398398

399399
/**
@@ -403,7 +403,7 @@ class ModifyControl extends Control {
403403
*/
404404
removeListeners() {
405405
clearTimeout(this.cursorTimeout);
406-
this.map.un('pointermove', this.cursorHandler);
406+
this.map?.un('pointermove', this.cursorHandler);
407407
}
408408

409409
/**

0 commit comments

Comments
 (0)