Permalink
Browse files

Recover from empty file

  • Loading branch information...
1 parent 9545c60 commit 65da33991868f73a90c6b944555d16be388ef221 @kriszyp kriszyp committed Feb 12, 2010
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/store/js-file.js
View
@@ -23,8 +23,11 @@ exports.JSFile = function(filename){
var fileTime = stat.mtime.getTime();
if(fileTime > lastMod){
lastMod = fileTime;
- var data = JSONExt.parse(File.read(filename));
- store.setIndex(data);
+ var contents = File.read(filename);
+ if(contents){
+ var data = JSONExt.parse(contents);
+ store.setIndex(data);
+ }
}
}
else if(lastMod === 0){

0 comments on commit 65da339

Please sign in to comment.