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
This commit is contained in:
Yury Delendik 2014-05-14 06:55:01 -05:00
commit df40ac99aa
2 changed files with 3 additions and 2 deletions

View File

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

View File

@ -65,7 +65,8 @@ describe('api', function() {
it('gets destinations', function() {
var promise = doc.getDestinations();
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() {