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