]> git.parisson.com Git - pdf.js.git/commitdiff
Handle missing encoding differences array
author= <=>
Tue, 20 Sep 2011 22:42:52 +0000 (15:42 -0700)
committer= <=>
Tue, 20 Sep 2011 22:42:52 +0000 (15:42 -0700)
pdf.js
test/pdfs/txt2pdf.pdf.link [new file with mode: 0644]
test/test_manifest.json

diff --git a/pdf.js b/pdf.js
index 0b810a3ee298309d1a3834f13d25104e106a395e..84c173f235d8e28f031cd428d11a150c030d262a 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -4324,14 +4324,16 @@ var PartialEvaluator = (function() {
             baseEncoding = Encodings[baseName.name].slice();
 
           // Load the differences between the base and original
-          var diffEncoding = encoding.get('Differences');
-          var index = 0;
-          for (var j = 0; j < diffEncoding.length; j++) {
-            var data = diffEncoding[j];
-            if (IsNum(data))
-              index = data;
-            else
-              differences[index++] = data.name;
+          if (encoding.has('Differences')) {
+            var diffEncoding = encoding.get('Differences');
+            var index = 0;
+            for (var j = 0; j < diffEncoding.length; j++) {
+              var data = diffEncoding[j];
+              if (IsNum(data))
+                index = data;
+              else
+                differences[index++] = data.name;
+            }
           }
         } else if (IsName(encoding)) {
           baseEncoding = Encodings[encoding.name].slice();
diff --git a/test/pdfs/txt2pdf.pdf.link b/test/pdfs/txt2pdf.pdf.link
new file mode 100644 (file)
index 0000000..09653f3
--- /dev/null
@@ -0,0 +1 @@
+http://www.sanface.com/pdf/test.pdf
index 44955eefafdc02e7e48e3fe6e982a8de1ed1cf99..a3115764a3d0bee1a04c82689a0ad2fd05d19666 100644 (file)
        "link": true,
        "rounds": 1,
        "type": "load"
+    },
+    {  "id": "txt2pdf",
+       "file": "pdfs/txt2pdf.pdf",
+       "link": true,
+       "rounds": 1,
+       "type": "load"
     }
 ]