blob: b6b0db1ec269c88306a795c4416cf52b3cfe9098 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
diff --git a/pdf_viewer/document.cpp b/pdf_viewer/document.cpp
index a2c8239..2b804a8 100644
--- a/pdf_viewer/document.cpp
+++ b/pdf_viewer/document.cpp
@@ -825,7 +825,7 @@ void Document::convert_toc_tree(fz_outline* root, std::vector<TocNode*>& output)
if (root->page.page == -1) {
float xp, yp;
fz_location loc = fz_resolve_link(context, doc, root->uri, &xp, &yp);
- int chapter_page = accum_chapter_pages[loc.chapter];
+ int chapter_page = (loc.chapter >= 0 && loc.chapter < accum_chapter_pages.size()) ? accum_chapter_pages[loc.chapter] : 0;
current_node->page = chapter_page + loc.page;
}
else {
|