From 2e3798e8b54fb267a96cf23e1ffd8c855bac4369 Mon Sep 17 00:00:00 2001 From: hrdl <31923882+hrdl-github@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:50:38 +0200 Subject: [PATCH] Don't allow nan values in toc nodes. Fix https://github.com/ahrm/sioyek/issues/539#issuecomment-1759302654 --- pdf_viewer/document.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pdf_viewer/document.cpp b/pdf_viewer/document.cpp index 6e6182015..2b833a32a 100644 --- a/pdf_viewer/document.cpp +++ b/pdf_viewer/document.cpp @@ -493,8 +493,8 @@ void Document::convert_toc_tree(fz_outline* root, std::vector& output) TocNode* current_node = new TocNode; current_node->title = utf8_decode(root->title); - current_node->x = root->x; - current_node->y = root->y; + current_node->x = std::isnan(root->x) ? 0.0 : root->x; + current_node->y = std::isnan(root->y) ? 0.0 : root->y; if (root->page.page == -1) { float xp, yp; fz_location loc = fz_resolve_link(context, doc, root->uri, &xp, &yp);