Don't update the chapter list if the parsed list is empty (#18)

This commit is contained in:
inorichi 2016-01-09 21:39:59 +01:00
parent 201650ced7
commit 6eb321bb06

View File

@ -84,8 +84,12 @@ public abstract class Source extends BaseSource {
public Observable<List<Chapter>> pullChaptersFromNetwork(final String mangaUrl) {
return networkService
.getStringResponse(getBaseUrl() + mangaUrl, requestHeaders, null)
.flatMap(unparsedHtml ->
Observable.just(parseHtmlToChapters(unparsedHtml)));
.flatMap(unparsedHtml -> {
List<Chapter> chapters = parseHtmlToChapters(unparsedHtml);
return !chapters.isEmpty() ?
Observable.just(chapters) :
Observable.error(new Exception("No chapters found"));
});
}
public Observable<List<Page>> getCachedPageListOrPullFromNetwork(final String chapterUrl) {