From 4fcb1a88d7ee3fc43743eac25db363a7dcbc1ab9 Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Sun, 15 Jul 2018 13:44:29 -0500 Subject: [PATCH] Fix empty exclusion storage error --- background/storage.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/background/storage.js b/background/storage.js index 25952b82..ee49cf5c 100644 --- a/background/storage.js +++ b/background/storage.js @@ -314,7 +314,7 @@ function filterStylesInternal({ omitCode, }); if (asHash) { - if (sections.length) { + if (sections.length && sections[0] !== '') { filtered[style.id] = sections; filtered.length++; } @@ -857,12 +857,14 @@ function detectSloppyRegexps({matchUrl, ids}) { if (!hasRegExp) continue; const applied = getApplicableSections({style, matchUrl, omitCode: false}); const wannabe = getApplicableSections({style, matchUrl, omitCode: false, strictRegexp: false}); - results.push({ - id, - applied, - skipped: wannabe.length - applied.length, - hasInvalidRegexps: wannabe.some(({regexps}) => regexps.some(rx => !rxCache.has(rx))), - }); + if (wannabe.length && wannabe[0] !== '') { + results.push({ + id, + applied, + skipped: wannabe.length - applied.length, + hasInvalidRegexps: wannabe.some(({regexps}) => regexps.some(rx => !rxCache.has(rx))), + }); + } } return results; }