diff --git a/modules/env.js b/modules/env.js index 3d0bdae..4835c9f 100644 --- a/modules/env.js +++ b/modules/env.js @@ -126,7 +126,11 @@ define([ } if (typeof states[namespace] === 'undefined') { - states[namespace] = angular.fromJson(storage.getItem(prefix)) || {}; + try { + states[namespace] = angular.fromJson(storage.getItem(prefix)) || {}; + } catch (e) { + states[namespace] = {}; + } } if (typeof states[namespace][key] === 'undefined') { states[namespace][key] = defaultvalue;