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

View file

@ -83,7 +83,10 @@ self.addEventListener('fetch', event => {
// for routes, serve the /index.html file from the most recent
// assets cache
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
}
}
}