From a50f030a3bd4daefa4869793d7ce78152135cb80 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Thu, 9 Apr 2020 14:08:26 -0400 Subject: [PATCH] Properly handle server error --- src/content.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/content.ts b/src/content.ts index e8fa1e52..f4108d13 100644 --- a/src/content.ts +++ b/src/content.ts @@ -605,12 +605,13 @@ function sponsorsLookup(id: string, channelIDPromise?) { categories }).then(async (response: Response) => { if (response.status === 200) { - sponsorDataFound = true; - let recievedSegments: SponsorTime[] = await response.json(); if (!recievedSegments.length) { console.error("[SponsorBlock] Server returned malformed response: " + JSON.stringify(recievedSegments)); + return; } + + sponsorDataFound = true; // Check if any old submissions should be kept if (sponsorTimes !== null) {