mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
ReaderView: Don't crash on pre-#11044 highlights without a color field (#12438)
(They'll be drawn in gray, as before) Regression since #11044 (https://github.com/koreader/koreader/pull/11044#issuecomment-2322820971)
This commit is contained in:
parent
49e885321a
commit
cf83dc8bd3
@ -546,7 +546,7 @@ function ReaderView:drawPageSavedHighlight(bb, x, y)
|
||||
for _, item in ipairs(items) do
|
||||
local boxes = self.document:getPageBoxesFromPositions(page, item.pos0, item.pos1)
|
||||
if boxes then
|
||||
local color = Blitbuffer.colorFromName(item.color)
|
||||
local color = item.color and Blitbuffer.colorFromName(item.color)
|
||||
if color and not Blitbuffer.isColor8(color) then
|
||||
colorful = true
|
||||
end
|
||||
@ -592,7 +592,7 @@ function ReaderView:drawXPointerSavedHighlight(bb, x, y)
|
||||
if end_pos >= cur_view_top then
|
||||
local boxes = self.document:getScreenBoxesFromPositions(item.pos0, item.pos1, true) -- get_segments=true
|
||||
if boxes then
|
||||
local color = Blitbuffer.colorFromName(item.color)
|
||||
local color = item.color and Blitbuffer.colorFromName(item.color)
|
||||
if color and not Blitbuffer.isColor8(color) then
|
||||
colorful = true
|
||||
end
|
||||
|
@ -245,7 +245,7 @@ function PdfDocument:saveHighlight(pageno, item)
|
||||
local quadpoints, n = _quadpointsFromPboxes(item.pboxes)
|
||||
local page = self._document:openPage(pageno)
|
||||
local annot_type = C.PDF_ANNOT_HIGHLIGHT
|
||||
local annot_color = BlitBuffer.colorFromName(item.color)
|
||||
local annot_color = item.color and BlitBuffer.colorFromName(item.color)
|
||||
if item.drawer == "lighten" then
|
||||
annot_type = C.PDF_ANNOT_HIGHLIGHT
|
||||
elseif item.drawer == "underscore" then
|
||||
|
Loading…
Reference in New Issue
Block a user