From df6fd387dfa9c781aa033ce4261a32c86773f35a Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Fri, 21 Jun 2013 15:42:55 -0500 Subject: [PATCH] Bug 879211: ignoring bad document outline reference --- src/obj.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/obj.js b/src/obj.js index 9df41af1c..a106896e5 100644 --- a/src/obj.js +++ b/src/obj.js @@ -244,6 +244,18 @@ var Catalog = (function CatalogClosure() { return shadow(this, 'toplevelPagesDict', pagesObj); }, get documentOutline() { + var obj = null; + try { + obj = this.readDocumentOutline(); + } catch (ex) { + if (ex instanceof MissingDataException) { + throw ex; + } + warn('Unable to read document outline'); + } + return shadow(this, 'documentOutline', obj); + }, + readDocumentOutline: function Catalog_readDocumentOutline() { var xref = this.xref; var obj = this.catDict.get('Outlines'); var root = { items: [] }; @@ -294,8 +306,7 @@ var Catalog = (function CatalogClosure() { } } } - obj = root.items.length > 0 ? root.items : null; - return shadow(this, 'documentOutline', obj); + return root.items.length > 0 ? root.items : null; }, get numPages() { var obj = this.toplevelPagesDict.get('Count');