From 36926b40a25b1df76c4474c89a51483b93d8a68c Mon Sep 17 00:00:00 2001
From: =?utf8?q?Aleksander=20=C5=81ukasz?=
 <aleksander.lukasz@nowoczesnapolska.org.pl>
Date: Tue, 19 Nov 2013 15:58:04 +0100
Subject: [PATCH] handle situation when nothing was actually unwrapped

---
 src/editor/modules/documentCanvas/commands.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/editor/modules/documentCanvas/commands.js b/src/editor/modules/documentCanvas/commands.js
index 1981429..6ff1d86 100644
--- a/src/editor/modules/documentCanvas/commands.js
+++ b/src/editor/modules/documentCanvas/commands.js
@@ -35,7 +35,9 @@ commands.register('unwrap-node', function(canvas) {
     } else if(!cursor.isSelecting()) {
         var nodeToUnwrap = cursor.getPosition().element.data('wlxmlNode'),
             parentNode = nodeToUnwrap.unwrap();
-        canvas.setCurrentElement(utils.findCanvasElement(parentNode));
+        if(parentNode) {
+            canvas.setCurrentElement(utils.findCanvasElement(parentNode));
+        }
     }
 });
 
-- 
2.20.1