From 85d9b2d227a1fa77584be7781db54a7a95c2973f Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 3 Feb 2015 13:17:03 +1100 Subject: [PATCH] regression, missing local storage would cause script to break --- .../javascripts/discourse/lib/emoji/emoji-toolbar.js.es6 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/lib/emoji/emoji-toolbar.js.es6 b/app/assets/javascripts/discourse/lib/emoji/emoji-toolbar.js.es6 index aea0c99c78a..2de2a76f54a 100644 --- a/app/assets/javascripts/discourse/lib/emoji/emoji-toolbar.js.es6 +++ b/app/assets/javascripts/discourse/lib/emoji/emoji-toolbar.js.es6 @@ -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);