[Pkg-javascript-commits] [pdf.js] 78/161: Fix Issue #4461: Pages without \Resources in their dictionary fail to load

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 14:16:31 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 1ddb0194494596b246fa151d089960f079b130fe
Author: Thorben Bochenek <thorbenb at opera.com>
Date:   Fri Mar 14 14:39:17 2014 +0100

    Fix Issue #4461: Pages without \Resources in their dictionary fail to load
    
    When no "\Resource" entry could be found return an empty dictionary
---
 src/core/core.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/core/core.js b/src/core/core.js
index ab17644..7ded6a8 100644
--- a/src/core/core.js
+++ b/src/core/core.js
@@ -57,7 +57,14 @@ var Page = (function PageClosure() {
       return this.getPageProp('Contents');
     },
     get resources() {
-      return shadow(this, 'resources', this.inheritPageProp('Resources'));
+      var value = this.getInheritedPageProp('Resources');
+      // For robustness: The spec states that a \Resources entry has to be
+      // present, but can be empty. Some document omit it still. In this case
+      // return an empty dictionary:
+      if (value === undefined) {
+        value = new Dict();
+      }
+      return shadow(this, 'resources', value);
     },
     get mediaBox() {
       var obj = this.inheritPageProp('MediaBox');

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list