From: Aleksander Ɓukasz Date: Wed, 23 Apr 2014 10:49:58 +0000 (+0200) Subject: editor: Better invalid cursor handling X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/732705c82a02743c942fd792e5b4438b045cf9f1?ds=sidebyside editor: Better invalid cursor handling --- diff --git a/src/editor/modules/documentCanvas/canvas/keyboard.js b/src/editor/modules/documentCanvas/canvas/keyboard.js index f879851..383ca18 100644 --- a/src/editor/modules/documentCanvas/canvas/keyboard.js +++ b/src/editor/modules/documentCanvas/canvas/keyboard.js @@ -183,11 +183,14 @@ handlers.push({keys: [KEYS.BACKSPACE, KEYS.DELETE], var cursor = canvas.getCursor(), position = canvas.getCursor().getPosition(), element = position.element, - node = element.wlxmlNode, + node = element ? element.wlxmlNode : null, direction = 'above', caretTo = 'end', goto; + if(!element || !node) { + return; + } if(event.which === KEYS.DELETE) { direction = 'below';