add null check for index.html fetch in SW (#484)

hopefully should fix #483
This commit is contained in:
Nolan Lawson 2018-08-24 08:51:09 -07:00 committed by GitHub
parent 91a92b0003
commit 8d2e0636d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -83,7 +83,10 @@ self.addEventListener('fetch', event => {
// for routes, serve the /index.html file from the most recent // for routes, serve the /index.html file from the most recent
// assets cache // assets cache
if (routes.find(route => route.pattern.test(url.pathname))) { if (routes.find(route => route.pattern.test(url.pathname))) {
return caches.match('/index.html') let response = await caches.match('/index.html')
if (response) {
return response
}
} }
} }