Fix crash due to empty page list.
This commit is contained in:
parent
1e797bfe8a
commit
f3be1a6d09
@ -264,6 +264,10 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
|
||||
fun onChapterReady(chapter: ReaderChapter) {
|
||||
please_wait.visibility = View.GONE
|
||||
val pages = chapter.pages ?: run { onChapterError(Exception("Null pages")); return }
|
||||
if(pages.isEmpty()) {
|
||||
onChapterError(Exception("Page list empty!"))
|
||||
return
|
||||
}
|
||||
val activePage = pages.getOrElse(chapter.requestedPage) { pages.first() }
|
||||
|
||||
viewer?.onPageListReady(chapter, activePage)
|
||||
|
Loading…
x
Reference in New Issue
Block a user