From a6a0f917e0030c547c514718d58eedc0b7fc903a Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Wed, 21 Aug 2019 14:35:46 -0400 Subject: [PATCH] Fixed preview not working when no sponsors are found. --- content.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/content.js b/content.js index add0b940..0cd02940 100644 --- a/content.js +++ b/content.js @@ -379,11 +379,14 @@ function sponsorsLookup(id) { } function updatePreviewBar() { - let allSponsorTimes = sponsorTimes.concat(sponsorTimesSubmitting); + let localSponsorTimes = sponsorTimes; + if (localSponsorTimes == null) localSponsorTimes = []; + + let allSponsorTimes = localSponsorTimes.concat(sponsorTimesSubmitting); //create an array of the sponsor types let types = []; - for (let i = 0; i < sponsorTimes.length; i++) { + for (let i = 0; i < localSponsorTimes.length; i++) { types.push("sponsor"); } for (let i = 0; i < sponsorTimesSubmitting.length; i++) {