diff --git a/async-storage.ts b/async-storage.ts index 35675e0..59a3255 100644 --- a/async-storage.ts +++ b/async-storage.ts @@ -5,8 +5,12 @@ export type AsyncStorageType = { } | null const AsyncStorage: AsyncStorageType = { getItemSync: function(key) { - const data = localStorage.getItem(key); - return data || null + try { + const data = localStorage.getItem(key); + return data || null + } catch (e) { + return null + } }, getItem: function (key, cb) { return new Promise((resolve, reject) => {