From 732705c82a02743c942fd792e5b4438b045cf9f1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Wed, 23 Apr 2014 12:49:58 +0200 Subject: [PATCH 1/1] editor: Better invalid cursor handling --- src/editor/modules/documentCanvas/canvas/keyboard.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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'; -- 2.20.1