editor: handle invalid element passed to setCurrentElement better
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 23 Apr 2014 09:59:27 +0000 (11:59 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 23 Apr 2014 09:59:27 +0000 (11:59 +0200)
src/editor/modules/documentCanvas/canvas/canvas.js

index 5cfc015..b217d18 100644 (file)
@@ -245,6 +245,11 @@ $.extend(Canvas.prototype, {
     },
 
     setCurrentElement: function(element, params) {
+        if(!element) {
+            logger.debug('Invalid element passed to setCurrentElement: ' + element);
+            return;
+        }
+
         if(!(element instanceof documentElement.DocumentElement)) {
             element = utils.findCanvasElement(element);
         }