Albirew/tachiyomi
Archivé
1
0
Bifurcation 0

Merge pull request #151 from icewind1991/chapter-recognition-fallback

Fix infinite loop when no chapter number is parsed
Cette révision appartient à :
inorichi 2016-02-16 20:41:34 +01:00
révision ff46c61f63
2 fichiers modifiés avec 16 ajouts et 6 suppressions

Voir le fichier

@ -111,12 +111,15 @@ public class ChapterRecognition {
}
// Strip anything after "part xxx" and try that
name = pPart.matcher(name).replaceAll("$1");
dummyChapter.name = name;
parseChapterNumber(dummyChapter, manga);
if (dummyChapter.chapter_number >= 0) {
chapter.chapter_number = dummyChapter.chapter_number;
return;
matcher = pPart.matcher(name);
if (matcher.find()) {
name = pPart.matcher(name).replaceAll("$1");
dummyChapter.name = name;
parseChapterNumber(dummyChapter, manga);
if (dummyChapter.chapter_number >= 0) {
chapter.chapter_number = dummyChapter.chapter_number;
return;
}
}
}

Voir le fichier

@ -172,4 +172,11 @@ public class ChapterRecognitionTest {
ChapterRecognition.parseChapterNumber(c, randomManga);
assertThat(c.chapter_number).isEqualTo(027f);
}
@Test
public void testUnparsable() {
Chapter c = createChapter("Foo");
ChapterRecognition.parseChapterNumber(c, randomManga);
assertThat(c.chapter_number).isEqualTo(-1f);
}
}