From 3ac730c053484165829791599e2c70c9e52ddde2 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Sat, 18 Jul 2020 21:21:53 -0400 Subject: Fix errors when response fails --- src/content.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/content.ts b/src/content.ts index 5128b4e6..68566389 100644 --- a/src/content.ts +++ b/src/content.ts @@ -618,7 +618,7 @@ function sponsorsLookup(id: string) { videoID: id, categories }).then(async (response: FetchResponse) => { - if (response.ok) { + if (response?.ok) { let recievedSegments: SponsorTime[] = JSON.parse(response.responseText); if (!recievedSegments.length) { console.error("[SponsorBlock] Server returned malformed response: " + JSON.stringify(recievedSegments)); @@ -662,7 +662,7 @@ function sponsorsLookup(id: string) { } sponsorLookupRetries = 0; - } else if (response.status === 404) { + } else if (response?.status === 404) { sponsorDataFound = false; //check if this video was uploaded recently -- cgit v1.2.3