mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
It's possible for the user to have selected nothing, and trying to operate on the nil highlight can cause confusion or crashes. This restores the behaviour before commit7a0e3d5e68("readerhighlight: remove selected_word and use selected_text everywhere"), which missed this case. In addition, add some debug guards to ReaderHighlight methods which cannot handle selected_text being nil (or at least, shouldn't be called with selected_text being nil). Fixes:7a0e3d5e68("readerhighlight: remove selected_word and use selected_text everywhere") Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>