mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 02:31:51 +01:00
Fix infinite loop when no chapter number is parsed
This commit is contained in:
parent
1e81f75377
commit
57b64a412e
@ -111,12 +111,15 @@ public class ChapterRecognition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Strip anything after "part xxx" and try that
|
// Strip anything after "part xxx" and try that
|
||||||
name = pPart.matcher(name).replaceAll("$1");
|
matcher = pPart.matcher(name);
|
||||||
dummyChapter.name = name;
|
if (matcher.find()) {
|
||||||
parseChapterNumber(dummyChapter, manga);
|
name = pPart.matcher(name).replaceAll("$1");
|
||||||
if (dummyChapter.chapter_number >= 0) {
|
dummyChapter.name = name;
|
||||||
chapter.chapter_number = dummyChapter.chapter_number;
|
parseChapterNumber(dummyChapter, manga);
|
||||||
return;
|
if (dummyChapter.chapter_number >= 0) {
|
||||||
|
chapter.chapter_number = dummyChapter.chapter_number;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,4 +172,11 @@ public class ChapterRecognitionTest {
|
|||||||
ChapterRecognition.parseChapterNumber(c, randomManga);
|
ChapterRecognition.parseChapterNumber(c, randomManga);
|
||||||
assertThat(c.chapter_number).isEqualTo(027f);
|
assertThat(c.chapter_number).isEqualTo(027f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUnparsable() {
|
||||||
|
Chapter c = createChapter("Foo");
|
||||||
|
ChapterRecognition.parseChapterNumber(c, randomManga);
|
||||||
|
assertThat(c.chapter_number).isEqualTo(-1f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user