mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-05 20:11:26 +01:00
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:
@@ -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;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user