1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 00:21:15 +03:00

Fix crash when there’s no outline

This commit is contained in:
Guillaume Ayoub 2020-04-21 23:07:35 +02:00
parent 44c21b7f31
commit 7de2e45f55

View File

@ -833,11 +833,12 @@ class Document:
last_by_depth.append(children)
outlines, count = create_bookmarks(root, pdf)
pdf.catalog['Outlines'] = pydyf.Dictionary({
'Count': count,
'First': outlines[0].reference,
'Last': outlines[-1].reference,
})
if outlines:
pdf.catalog['Outlines'] = pydyf.Dictionary({
'Count': count,
'First': outlines[0].reference,
'Last': outlines[-1].reference,
})
PROGRESS_LOGGER.info('Step 7 - Adding PDF metadata')