Fix null object in search for users with no preferences set.

localStorage.getItem returned null, and JSON.parse(null) is null.
This commit is contained in:
Ben Lubar
2016-08-23 19:35:50 -05:00
parent dbdbfc6d75
commit 598935b3bf

View File

@@ -75,7 +75,7 @@ define('search', ['navigator', 'translator'], function(nav, translator) {
Search.getSearchPreferences = function() {
try {
return JSON.parse(localStorage.getItem('search-preferences'));
return JSON.parse(localStorage.getItem('search-preferences') || '{}');
} catch(e) {
return {};
}
@@ -179,4 +179,4 @@ define('search', ['navigator', 'translator'], function(nav, translator) {
};
return Search;
});
});