From 12cdad066e8955e8f21069ef6a0a8ec64f763584 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 29 Nov 2019 10:08:15 +0100 Subject: [PATCH] Make Cursor.detach() safe to call when not attached Avoids having checks in higher layers. --- kasmweb/core/util/cursor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kasmweb/core/util/cursor.js b/kasmweb/core/util/cursor.js index 3535813..99fe502 100644 --- a/kasmweb/core/util/cursor.js +++ b/kasmweb/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);