From b06bd37037f8017e5af81c82e511f2528d671086 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Le=20Ninivin?= <cedric.leninivin@tiolive.com>
Date: Mon, 15 Jun 2020 15:30:47 +0200
Subject: [PATCH] Fix SW Gadget Catch of error

---
 gadget/crib-sw-gadget.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gadget/crib-sw-gadget.js b/gadget/crib-sw-gadget.js
index 587b0c0..4fddf21 100644
--- a/gadget/crib-sw-gadget.js
+++ b/gadget/crib-sw-gadget.js
@@ -38,7 +38,7 @@
       })
       .push(undefined, function (e) {
         // Ugly Hack to reload page and make service worker available
-        if (e.indexOf("Please reload this page to allow Service Worker to control this page") > -1 ) {
+        if (e && e.indexOf("Please reload this page to allow Service Worker to control this page") > -1 ) {
           console.log("reload");
           window.location.reload(false);
           throw(e);
-- 
2.30.9