From 05c36c4c2645f5314289c46e3321435b6a261363 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 9 Jan 2025 15:31:37 -0800 Subject: [PATCH] GUACAMOLE-2018: Convert layer to canvas during exportState() only if layer is non-empty. --- guacamole-common-js/src/main/webapp/modules/Client.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/guacamole-common-js/src/main/webapp/modules/Client.js b/guacamole-common-js/src/main/webapp/modules/Client.js index bd59d651a..03dee3e1b 100644 --- a/guacamole-common-js/src/main/webapp/modules/Client.js +++ b/guacamole-common-js/src/main/webapp/modules/Client.js @@ -194,7 +194,6 @@ Guacamole.Client = function(tunnel) { var index = parseInt(key); var layer = layersSnapshot[key]; - var canvas = layer.toCanvas(); // Store layer/buffer dimensions var exportLayer = { @@ -203,8 +202,10 @@ Guacamole.Client = function(tunnel) { }; // Store layer/buffer image data, if it can be generated - if (layer.width && layer.height) + if (layer.width && layer.height) { + var canvas = layer.toCanvas(); exportLayer.url = canvas.toDataURL('image/png'); + } // Add layer properties if not a buffer nor the default layer if (index > 0) {