Copying from a buffer with no width/height should not fail. Hard exceptions in handle...
authorMichael Jumper <zhangmaike@users.sourceforge.net>
Tue, 10 Jan 2012 19:37:10 +0000 (11:37 -0800)
committerMichael Jumper <zhangmaike@users.sourceforge.net>
Tue, 10 Jan 2012 19:37:10 +0000 (11:37 -0800)
src/main/resources/layer.js

index bd6af67..e762060 100644 (file)
@@ -141,7 +141,7 @@ Guacamole.Layer = function(width, height) {
 
         // Redraw old data, if any
         if (oldData)
-            displayContext.drawImage(oldData, 
+                displayContext.drawImage(oldData, 
                     0, 0, width, height,
                     0, 0, width, height);
 
@@ -400,7 +400,10 @@ Guacamole.Layer = function(width, height) {
 
         function doCopyRect() {
             if (layer.autosize != 0) fitRect(x, y, srcw, srch);
-            displayContext.drawImage(srcLayer.getCanvas(), srcx, srcy, srcw, srch, x, y, srcw, srch);
+
+            var srcCanvas = srcLayer.getCanvas();
+            if (srcCanvas.width != 0 && srcCanvas.height != 0)
+                displayContext.drawImage(srcCanvas, srcx, srcy, srcw, srch, x, y, srcw, srch);
         }
 
         // If we ARE the source layer, no need to sync.