diff --git a/src/static/js/pad_cookie.js b/src/static/js/pad_cookie.js index 0e946ea5c89..f19fc4ab296 100644 --- a/src/static/js/pad_cookie.js +++ b/src/static/js/pad_cookie.js @@ -55,11 +55,15 @@ exports.padcookie = new class { } getPref(prefName) { - return this.readPrefs_()[prefName]; + const prefs = this.readPrefs_(); + return prefs ? prefs[prefName] : null; } setPref(prefName, value) { const prefs = this.readPrefs_(); + if (!prefs) { + return; + } prefs[prefName] = value; this.writePrefs_(prefs); }