aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2019-08-31 21:17:07 -0400
committerAjay Ramachandran <[email protected]>2019-08-31 21:17:07 -0400
commit21ce614bd92231df1d1c2e0df907a79b8bb01981 (patch)
tree29ba260b428eb9a0d36bdfd5e34544488c9d9cfd
parent7f56ec238fcfac7c84ba373f2ea7e86f63658b6e (diff)
downloadSponsorBlock-21ce614bd92231df1d1c2e0df907a79b8bb01981.tar.gz
SponsorBlock-21ce614bd92231df1d1c2e0df907a79b8bb01981.zip
Made the function clear whitelisted channels that were null.
-rw-r--r--content.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/content.js b/content.js
index 774d5b01..ceb9deb3 100644
--- a/content.js
+++ b/content.js
@@ -500,6 +500,23 @@ function whitelistCheck() {
UUIDs = [];
channelWhitelisted = true;
+
+ //make sure the whitelistedChannels array isn't broken and full of null entries
+ //TODO: remove this at some point in the future as the bug that caused this should be patched
+ if (whitelistedChannels.some((el) => el === null)) {
+ //remove the entries that are null
+ let cleanWhitelistedChannelsArray = [];
+ for (let i = 0; i < whitelistedChannels.length; i++) {
+ let channelURL = whitelistedChannels[i];
+ if (channelURL !== null) {
+ //add it
+ cleanWhitelistedChannelsArray.push(channelURL);
+ }
+ }
+
+ //save this value
+ chrome.storage.sync.set({"whitelistedChannels": cleanWhitelistedChannelsArray});
+ }
}
});
}