[Pkg-javascript-commits] [pdf.js] 63/174: Ensure that `Dict_getArray` doesn't fail if `xref` in undefined (PR 6485 follow-up)
David Prévot
taffit at moszumanska.debian.org
Thu Nov 19 18:45:13 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 49883439a58d4505342e8e7dcae39bc69ee51983
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Thu Oct 15 11:47:07 2015 +0200
Ensure that `Dict_getArray` doesn't fail if `xref` in undefined (PR 6485 follow-up)
In PR 6485 I somehow missed to account for the case where `xref` is undefined. Since a dictonary can be initialized without providing a reference to an `xref` instance, `Dict_getArray` can thus fail without this added check.
---
src/core/obj.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/core/obj.js b/src/core/obj.js
index ca92b77..fe5135f 100644
--- a/src/core/obj.js
+++ b/src/core/obj.js
@@ -138,7 +138,8 @@ var Dict = (function DictClosure() {
// Same as get(), but dereferences all elements if the result is an Array.
getArray: function Dict_getArray(key1, key2, key3) {
var value = this.get(key1, key2, key3);
- if (!isArray(value)) {
+ var xref = this.xref;
+ if (!isArray(value) || !xref) {
return value;
}
value = value.slice(); // Ensure that we don't modify the Dict data.
@@ -146,7 +147,7 @@ var Dict = (function DictClosure() {
if (!isRef(value[i])) {
continue;
}
- value[i] = this.xref.fetch(value[i]);
+ value[i] = xref.fetch(value[i]);
}
return value;
},
--
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