summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-page.c
diff options
context:
space:
mode:
authorSimon Bünzli <zeniko@gmail.com>2014-01-03 11:39:19 +0100
committerRobin Watts <robin.watts@artifex.com>2014-01-06 13:13:37 +0000
commit646abf766e4037ba1ce9e564423cf827a203b94a (patch)
tree608884ff19f3ed98f50e14a1fcfe13431c55f850 /source/pdf/pdf-page.c
parentfc0432b9121d528d9b775cd9ed103732c6440973 (diff)
downloadmupdf-646abf766e4037ba1ce9e564423cf827a203b94a.tar.xz
tolerate slightly broken page trees
At https://code.google.com/p/sumatrapdf/issues/detail?id=2460 , there's a file with missing /Type keys in the page tree nodes. In that case, leaf nodes and intermediary nodes have to be distinguished in a different way.
Diffstat (limited to 'source/pdf/pdf-page.c')
-rw-r--r--source/pdf/pdf-page.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/pdf/pdf-page.c b/source/pdf/pdf-page.c
index 10496d57..f3c929d2 100644
--- a/source/pdf/pdf-page.c
+++ b/source/pdf/pdf-page.c
@@ -64,7 +64,7 @@ pdf_lookup_page_loc_imp(pdf_document *doc, pdf_obj *node, int *skip, pdf_obj **p
{
pdf_obj *kid = pdf_array_get(kids, i);
char *type = pdf_to_name(pdf_dict_gets(kid, "Type"));
- if (!strcmp(type, "Page"))
+ if (!strcmp(type, "Page") || (!*type && pdf_dict_gets(kid, "MediaBox")))
{
if (*skip == 0)
{
@@ -78,7 +78,7 @@ pdf_lookup_page_loc_imp(pdf_document *doc, pdf_obj *node, int *skip, pdf_obj **p
(*skip)--;
}
}
- else if (!strcmp(type, "Pages"))
+ else if (!strcmp(type, "Pages") || (!*type && pdf_dict_gets(kid, "Kids")))
{
int count = pdf_to_int(pdf_dict_gets(kid, "Count"));
if (*skip < count)
@@ -93,7 +93,7 @@ pdf_lookup_page_loc_imp(pdf_document *doc, pdf_obj *node, int *skip, pdf_obj **p
}
else
{
- fz_throw(ctx, FZ_ERROR_GENERIC, "non-page object in page tree");
+ fz_throw(ctx, FZ_ERROR_GENERIC, "non-page object in page tree (%s)", type);
}
}
}