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:
parent
e4be17a428
commit
c17e707ec4
6 changed files with 26 additions and 18 deletions
|
@ -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){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue