Browse Source

Merge pull request #4796 from Snuffleupagus/get-destinations-empty-Names

Check if the Names dictionary actually contains a Dests dictionary before attempting to get the destinations
Yury Delendik 11 years ago
parent
commit
df40ac99aa
  1. 2
      src/core/obj.js
  2. 3
      test/unit/api_spec.js

2
src/core/obj.js

@ -419,7 +419,7 @@ var Catalog = (function CatalogClosure() {
var xref = this.xref; var xref = this.xref;
var dests = {}, nameTreeRef, nameDictionaryRef; var dests = {}, nameTreeRef, nameDictionaryRef;
var obj = this.catDict.get('Names'); var obj = this.catDict.get('Names');
if (obj) { if (obj && obj.has('Dests')) {
nameTreeRef = obj.getRaw('Dests'); nameTreeRef = obj.getRaw('Dests');
} else if (this.catDict.has('Dests')) { } else if (this.catDict.has('Dests')) {
nameDictionaryRef = this.catDict.get('Dests'); nameDictionaryRef = this.catDict.get('Dests');

3
test/unit/api_spec.js

@ -65,7 +65,8 @@ describe('api', function() {
it('gets destinations', function() { it('gets destinations', function() {
var promise = doc.getDestinations(); var promise = doc.getDestinations();
waitsForPromise(promise, function(data) { waitsForPromise(promise, function(data) {
// TODO this seems to be broken for the test pdf expect(data).toEqual({ chapter1: [{ gen: 0, num: 17 }, { name: 'XYZ' },
0, 841.89, null] });
}); });
}); });
it('gets outline', function() { it('gets outline', function() {

Loading…
Cancel
Save