1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

Break out of restore loop and check for null

This commit is contained in:
Fred Chasen 2014-01-02 21:12:51 -08:00
parent e4be17a428
commit c17e707ec4
6 changed files with 26 additions and 18 deletions

View file

@ -2223,14 +2223,18 @@ EPUBJS.Book.prototype.restore = function(identifier){
if(this.settings.clearSaved) reject = true;
if(!reject && fromStore != 'undefined' && fromStore != 'null'){
this.contents = JSON.parse(fromStore);
fetch.forEach(function(item){
book[item] = book.contents[item];
if(!book[item]) {
if(!reject && fromStore != 'undefined' && fromStore != null){
book.contents = JSON.parse(fromStore);
for(var i = 0, len = fetch.length; i < len; i++) {
var item = fetch[i];
if(!book.contents[item]) {
reject = true;
break;
}
});
book[item] = book.contents[item];
}
}
if(reject || !fromStore || !this.contents || !this.settings.contentsPath){