Permalink
Browse files

Bug 825985 - If we can't parse the settings, use the default ones.

  • Loading branch information...
rik committed Jan 7, 2013
1 parent 550e477 commit 46fc25f35611db6ecff40370e02b9a7e8f97b7e1
Showing with 12 additions and 12 deletions.
  1. +12 −12 apps/costcontrol/js/config_manager.js
@@ -99,20 +99,20 @@ var ConfigManager = (function() {
function requestSettings(callback) { function requestSettings(callback) {
asyncStorage.getItem(currentICCID, function _wrapGetItem(localSettings) { asyncStorage.getItem(currentICCID, function _wrapGetItem(localSettings) {
// No entry: set defaults // No entry: set defaults
settings = JSON.parse(localSettings, settingsReviver); try {
if (settings !== null) { settings = JSON.parse(localSettings, settingsReviver);
if (callback) } catch(e) {
callback(settings); // If we can't parse the settings, use the default ones
return;
} }
settings = deepCopy(DEFAULT_SETTINGS); if (settings === null) {
asyncStorage.setItem(currentICCID, JSON.stringify(settings), settings = deepCopy(DEFAULT_SETTINGS);
function _onceSettingsSet() { asyncStorage.setItem(currentICCID, JSON.stringify(settings));
if (callback) }
callback(settings);
} if (callback) {
); callback(settings);
}
}); });
} }

0 comments on commit 46fc25f

Please sign in to comment.