Skip to content

Commit

Permalink
Update MangaElt.js
Browse files Browse the repository at this point in the history
This should fix merges AllMangasReader-dev#111
Trying to parse an array, that is already been parsed and instatntiated as an array is gonna blow up.

Test case:{\"mirror\":\"Manga-Fox\",\"name\":\"1/2 Prince\",\"url\":\"http://mangafox.me/manga/1_2_prince/\",\"lastChapterReadURL\":\"http://mangafox.me/manga/1_2_prince/v14/c069/\",\"lastChapterReadName\":\"1/2 Prince 69\",\"read\":0,\"update\":1,\"ts\":1407828322,\"display\":0,\"cats\":\"[]\"},
  • Loading branch information
athalius committed Sep 2, 2014
1 parent b7f2d99 commit cbf71d4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion js/MangaElt.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ function MangaElt(obj) {
this.update = obj.update;
}
if (obj.cats !== undefined && obj.cats !== null) {
this.cats = JSON.parse(obj.cats) || obj.cats || [];
if(obj.cats instanceof Array){
this.cats= obj.cats;
}else{
this.cats = JSON.parse(obj.cats) || [];
}
}
if (obj.ts && fromSite) {
this.ts = obj.ts;
Expand Down

0 comments on commit cbf71d4

Please sign in to comment.