From: Art Cancro Date: Wed, 11 Oct 2023 22:44:05 +0000 (-0400) Subject: Don't try to destroy the upload window if it doesn't exist. X-Git-Tag: v997~118 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=a061ed7408edf2ac69f0045a72a24e7e95f5b31a Don't try to destroy the upload window if it doesn't exist. --- diff --git a/webcit-ng/static/js/upload.js b/webcit-ng/static/js/upload.js index 6dbd92e64..2d0751baf 100644 --- a/webcit-ng/static/js/upload.js +++ b/webcit-ng/static/js/upload.js @@ -12,7 +12,10 @@ var uploads = [] ; // everything the user has uploaded // Remove the upload window completely (even if it's hidden) function deactivate_uploads() { - document.getElementById("ctdl-upload").remove(); + upload_window = document.getElementById('ctdl-upload'); + if (upload_window) { + upload_window.remove(); + } } @@ -151,7 +154,11 @@ function show_or_hide_upload_window() { // Flush all uploaded files and close the window function flush_uploads() { - document.getElementById('ctdl-upload').style.display='none'; + upload_window = document.getElementById('ctdl-upload'); + + if (upload_window) { + upload_window.style.display='none'; + } // FIXME tell the server to delete the files uploads.forEach(u => {