Merge pull request #229 from cdwiegand/master

fix JSON.parse(null)
This commit is contained in:
Tankred Hase 2014-06-13 14:19:51 +02:00
commit 2dbe7e30b0

View File

@ -17,7 +17,8 @@ function LocalStorage() {
* if config is null the default config will be used
*/
LocalStorage.prototype.read = function () {
var cf = JSON.parse(window.localStorage.getItem("config"));
var raw = window.localStorage.getItem("config");
var cf = (raw === null ? null : JSON.parse(raw));
if (cf === null) {
this.config = this.default_config;
this.write();