diff options
author | Ajay Ramachandran <[email protected]> | 2020-07-18 21:21:53 -0400 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2020-07-18 21:21:53 -0400 |
commit | 3ac730c053484165829791599e2c70c9e52ddde2 (patch) | |
tree | 894c7177be72f6bb7c285a143955dc71aa0c3b46 /src | |
parent | d25951f3133ea91f6fb90c8dfb893554c25f36d9 (diff) | |
download | SponsorBlock-3ac730c053484165829791599e2c70c9e52ddde2.tar.gz SponsorBlock-3ac730c053484165829791599e2c70c9e52ddde2.zip |
Fix errors when response fails
Diffstat (limited to 'src')
-rw-r--r-- | src/content.ts | 4 |
1 files changed, 2 insertions, 2 deletions
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 |