Browse Source

fix(localStorage): exception if localStorage is disabled

dev1
hristoterezov 8 years ago
parent
commit
fb8b139856
1 changed files with 8 additions and 1 deletions
  1. 8
    1
      modules/settings/Settings.js

+ 8
- 1
modules/settings/Settings.js View File

@@ -13,8 +13,15 @@ function getLocalStorage() {
13 13
 
14 14
     // eslint-disable-next-line no-invalid-this
15 15
     const global = typeof window === 'undefined' ? this : window;
16
+    let storage;
16 17
 
17
-    return global.localStorage;
18
+    try {
19
+        storage = global.localStorage;
20
+    } catch (error) {
21
+        logger.error(error);
22
+    }
23
+
24
+    return storage;
18 25
 }
19 26
 
20 27
 /**

Loading…
Cancel
Save