[Spice-devel] [spice-html5][PATCH v2 08/13] Fix disconnect() code

Cédric Bosdonnat cbosdonnat at suse.com
Thu Feb 14 09:44:51 UTC 2019


The disconnect() function were not checking the existence of the file
transfer area element, leading to stop the disconnect() before its end.
---
 spice.html      | 4 +++-
 spice_auto.html | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/spice.html b/spice.html
index 9387076..f9e1af4 100644
--- a/spice.html
+++ b/spice.html
@@ -102,7 +102,9 @@
                 if (window.File && window.FileReader && window.FileList && window.Blob)
                 {
                     var spice_xfer_area = document.getElementById('spice-xfer-area');
-                    document.getElementById('spice-area').removeChild(spice_xfer_area);
+                    if (spice_xfer_area != null) {
+                      document.getElementById('spice-area').removeChild(spice_xfer_area);
+                    }
                     document.getElementById('spice-area').removeEventListener('dragover', SpiceHtml5.handle_file_dragover, false);
                     document.getElementById('spice-area').removeEventListener('drop', SpiceHtml5.handle_file_drop, false);
                 }
diff --git a/spice_auto.html b/spice_auto.html
index 08db248..71c6556 100644
--- a/spice_auto.html
+++ b/spice_auto.html
@@ -142,7 +142,9 @@
                 if (window.File && window.FileReader && window.FileList && window.Blob)
                 {
                     var spice_xfer_area = document.getElementById('spice-xfer-area');
-                    document.getElementById('spice-area').removeChild(spice_xfer_area);
+                    if (spice_xfer_area != null) {
+                      document.getElementById('spice-area').removeChild(spice_xfer_area);
+                    }
                     document.getElementById('spice-area').removeEventListener('dragover', SpiceHtml5.handle_file_dragover, false);
                     document.getElementById('spice-area').removeEventListener('drop', SpiceHtml5.handle_file_drop, false);
                 }
-- 
2.19.2



More information about the Spice-devel mailing list