regression, missing local storage would cause script to break

This commit is contained in:
Sam 2015-02-03 13:17:03 +11:00
parent 78b879d666
commit 85d9b2d227

View File

@ -64,7 +64,13 @@ var initializeUngroupedIcons = function(){
}
};
if (!localStorage.emojiUsage) { localStorage.emojiUsage = "{}"; }
try {
if (localStorage && !localStorage.emojiUsage) { localStorage.emojiUsage = "{}"; }
} catch(e){
/* localStorage can be disabled, or cookies disabled, do not crash script here
* TODO introduce a global wrapper for dealing with local storage
* */
}
var trackEmojiUsage = function(title){
var recent = JSON.parse(localStorage.emojiUsage);