From 44cc6f11c7be087042878f7e8850b4f4f5e318be Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 1 Jul 2023 10:36:46 -0400 Subject: [PATCH] Fix crash when tapping reader in long strip mode before RecyclerView is created --- .../tachiyomi/ui/reader/viewer/webtoon/WebtoonFrame.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonFrame.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonFrame.kt index 56b459701..572335b25 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonFrame.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonFrame.kt @@ -52,11 +52,15 @@ class WebtoonFrame(context: Context) : FrameLayout(context) { recycler?.getHitRect(recyclerRect) ?: return super.dispatchTouchEvent(ev) // Shrink the box to account for any rounding issues. recyclerRect.inset(1, 1) + + if (recyclerRect.right < recyclerRect.left || recyclerRect.bottom < recyclerRect.top) { + return super.dispatchTouchEvent(ev) + } + ev.setLocation( ev.x.coerceIn(recyclerRect.left.toFloat(), recyclerRect.right.toFloat()), ev.y.coerceIn(recyclerRect.top.toFloat(), recyclerRect.bottom.toFloat()), ) - return super.dispatchTouchEvent(ev) }