diff options
author | Pierre Ossman <ossman@cendio.se> | 2019-11-29 10:08:15 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2019-11-29 10:08:15 +0100 |
commit | 9f557f5280063b6e194da4541db75c568d27a901 (patch) | |
tree | f5299f3373c811330701e653cdd6119f441e88e6 | |
parent | 94c89284fc1f4e4c41c0cf949fb6ef4c6e8eb332 (diff) | |
download | novnc-9f557f5280063b6e194da4541db75c568d27a901.tar.gz |
Make Cursor.detach() safe to call when not attached
Avoids having checks in higher layers.
-rw-r--r-- | core/util/cursor.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/util/cursor.js b/core/util/cursor.js index 3535813..99fe502 100644 --- a/core/util/cursor.js +++ b/core/util/cursor.js @@ -64,6 +64,10 @@ export default class Cursor { } detach() { + if (!this._target) { + return; + } + if (useFallback) { const options = { capture: true, passive: true }; this._target.removeEventListener('mouseover', this._eventHandlers.mouseover, options); |