From 590aa9ab17b220402fcfb2a3a9fe852be3a6868e Mon Sep 17 00:00:00 2001 From: Alan Richey Date: Fri, 13 Oct 2017 09:30:41 -0500 Subject: [PATCH] Fixed the "Uncaught TypeError: Cannot read property 'className' of null" bug that appears when creating folders (coding style adjustments) --- browser/main/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/browser/main/index.js b/browser/main/index.js index 3fa123ea..00c32d36 100644 --- a/browser/main/index.js +++ b/browser/main/index.js @@ -27,10 +27,10 @@ document.addEventListener('click', function (e) { const className = e.target.className if (!className && typeof (className) !== 'string') return const isInfoButton = className.includes('infoButton') - let isInfoPanel = false - if (e.target.offsetParent !== null) { - isInfoPanel = e.target.offsetParent.className.includes('infoPanel') - } + const offsetParent = e.target.offsetParent + const isInfoPanel = offsetParent !== null + ? offsetParent.className.includes('infoPanel') + : false if (isInfoButton || isInfoPanel) return const infoPanel = document.querySelector('.infoPanel') if (infoPanel) infoPanel.style.display = 'none'