From e094c3918658db755dd577b666efdf93b8673bdf Mon Sep 17 00:00:00 2001 From: rugk Date: Thu, 19 Mar 2026 17:03:09 +0000 Subject: [PATCH] fix: fix nullable problems found via AttachmentViewer test --- js/privatebin.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 26ec0460..08651ccd 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2987,8 +2987,10 @@ window.PrivateBin = (function () { me.hideAttachment(); me.hideAttachmentPreview(); attachment.innerHTML = ''; - attachmentPreview.innerHTML = ''; - dragAndDropFileNames.innerHTML = ''; + if (attachmentPreview) { + attachmentPreview.innerHTML = ''; + } + me.clearDragAndDrop(); AttachmentViewer.removeAttachmentData(); }; @@ -3027,7 +3029,7 @@ window.PrivateBin = (function () { * @param {string[]} fileNames */ function printDragAndDropFileNames(fileNames) { - dragAndDropFileNames.innerHTML = ''; + me.clearDragAndDrop(); fileNames.forEach(fileName => { const name = document.createTextNode(fileName); dragAndDropFileNames.appendChild(name);