Fix crash due to empty page list.
This commit is contained in:
parent
1e797bfe8a
commit
f3be1a6d09
1 changed files with 4 additions and 0 deletions
|
|
@ -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…
Reference in a new issue