瀏覽代碼

test: guard due to test error (fatal memory crash)

Co-Authored-By: Copilot
rugk 5 月之前
父節點
當前提交
84e7cbdfbf
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      js/privatebin.js

+ 5 - 2
js/privatebin.js

@@ -2012,8 +2012,11 @@ window.PrivateBin = (function() {
          */
         me.init = function()
         {
-            // hide "no javascript" error message
-            document.getElementById('noscript').style.display = 'none';
+            // hide "no javascript" error message (guard in test environments)
+            const noscriptEl = document.getElementById('noscript');
+            if (noscriptEl) {
+                noscriptEl.style.display = 'none';
+            }
 
             // not a reset, but first set of the elements
             errorMessage = document.getElementById('errormessage');