From 0a4845c7a4f17b0a7133531a2defaf186777d800 Mon Sep 17 00:00:00 2001 From: Brandon Durham Date: Tue, 30 May 2017 12:41:58 -0400 Subject: [PATCH] fix: Add `null` check to `removeStyleElement` (#245) --- lib/addStyles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/addStyles.js b/lib/addStyles.js index 7b565f03..8ee709ed 100644 --- a/lib/addStyles.js +++ b/lib/addStyles.js @@ -166,10 +166,10 @@ function insertStyleElement (options, style) { } function removeStyleElement (style) { + if (style.parentNode === null) return false; style.parentNode.removeChild(style); var idx = stylesInsertedAtTop.indexOf(style); - if(idx >= 0) { stylesInsertedAtTop.splice(idx, 1); }