From 93170259b1b506f3582e1455c9fc6bb8fbcfda7b Mon Sep 17 00:00:00 2001 From: poire-z Date: Sun, 17 May 2026 21:12:46 +0200 Subject: [PATCH] Highlighting: avoid crash on PDF when nothing selected Oversight in 148449df6. --- frontend/apps/reader/modules/readerhighlight.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/apps/reader/modules/readerhighlight.lua b/frontend/apps/reader/modules/readerhighlight.lua index 2be9a9913..64962ce5d 100644 --- a/frontend/apps/reader/modules/readerhighlight.lua +++ b/frontend/apps/reader/modules/readerhighlight.lua @@ -1810,12 +1810,14 @@ function ReaderHighlight:onHold(arg, ges) end return true end - -- It has happened it failed because the text range was detected on the - -- previous page and highlighted by crengine, but no word was returned - -- (because the boxes were not on the current page). - -- Be sure we clear any such selection - self.ui.document:clearSelection() - -- And that we don't get stuck in a hold state + if self.ui.rolling then + -- It has happened it failed because the text range was detected on the + -- previous page and highlighted by crengine, but no word was returned + -- (because the boxes were not on the current page). + -- Be sure we clear any such selection + self.ui.document:clearSelection() + end + -- Be sure we don't get stuck in a hold state self.hold_pos = nil return false end