Skip to content
Snippets Groups Projects
Commit 2125c43f authored by m j's avatar m j
Browse files

handle empty json data files more gracefully

parent dab37290
No related branches found
No related tags found
No related merge requests found
......@@ -677,7 +677,12 @@ function JSONdb (fileName, scope) {
if(!this.file.open("r",true))
return;
var data = this.file.readAll(this.settings.FILE_BUFFER).join('\n');
this.masterData.data = JSON.parse(data);
if(data.length > 0) {
this.masterData.data = JSON.parse(data);
}
else {
this.masterData.data = {};
}
this.file.close();
this.masterShadow.data=composite_sketch(this.masterData.data);
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment