From d49bb4dfc87eea97963f65faf3960999f0df57ad Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Sun, 4 Jul 2021 16:46:16 -0400 Subject: [PATCH] fix for that last commit --- .../tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt index 9990b916de..ad8577ef25 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt @@ -182,7 +182,8 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() { // Step 1: segment the pages and transition pages subItems.forEach { if (it is ReaderPage) { - if (pagedItems.last().lastOrNull()?.chapter?.chapter?.id != it.chapter.chapter.id) { + if (pagedItems.last().lastOrNull() != null && + pagedItems.last().last()?.chapter?.chapter?.id != it.chapter.chapter.id) { pagedItems.add(mutableListOf()) } pagedItems.last().add(it)