From 3139556838022a2699cb51c24241e207529e1c0f Mon Sep 17 00:00:00 2001 From: John Whitington Date: Tue, 2 Jul 2019 18:37:08 +0100 Subject: [PATCH] Better verification of bookmark files --- cpdf.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpdf.ml b/cpdf.ml index ebf15d1..b48bd6d 100644 --- a/cpdf.ml +++ b/cpdf.ml @@ -984,7 +984,9 @@ let rec verify_bookmarks pdf lastlevel fastrefnums endpage = function let verify_bookmarks pdf lastlevel endpage marks = let refnums = Pdf.page_reference_numbers pdf in let fastrefnums = hashtable_of_dictionary (combine refnums (indx refnums)) in - verify_bookmarks pdf lastlevel fastrefnums endpage marks + match marks with + | [] -> true + | m::more -> m.Pdfmarks.level = 0 && verify_bookmarks pdf lastlevel fastrefnums endpage more (* Parse a line of the bookmarks file. *)