Skip to content

Commit

Permalink
fix: unlisten only when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
oterral committed May 14, 2024
1 parent 63f1bd0 commit b102929
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/control/modify.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ class ModifyControl extends Control {
*/
addListeners() {
this.removeListeners();
this.map.on('pointermove', this.cursorHandler);
this.map?.on('pointermove', this.cursorHandler);
}

/**
Expand All @@ -403,7 +403,7 @@ class ModifyControl extends Control {
*/
removeListeners() {
clearTimeout(this.cursorTimeout);
this.map.un('pointermove', this.cursorHandler);
this.map?.un('pointermove', this.cursorHandler);
}

/**
Expand Down

0 comments on commit b102929

Please sign in to comment.