mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Fix the inconsistent return types for Dict.{get, getAsync}
Having these methods fallback to returning `null` in only *one* particular case seems outright wrong, since a "falsy" value will thus be handled incorrectly. The only reason that this hasn't caused issues in practice is that there's only one call-site passing in three keys, and in that case we're trying to read a font file where falling back to `null` isn't a problem.
This commit is contained in:
parent
9596d702a9
commit
7f18c57c12
2 changed files with 4 additions and 6 deletions
|
@ -92,7 +92,7 @@ var Dict = (function DictClosure() {
|
|||
key2 in this._map || typeof key3 === 'undefined') {
|
||||
return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
|
||||
}
|
||||
value = this._map[key3] || null;
|
||||
value = this._map[key3];
|
||||
return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
|
||||
},
|
||||
|
||||
|
@ -114,7 +114,7 @@ var Dict = (function DictClosure() {
|
|||
}
|
||||
return Promise.resolve(value);
|
||||
}
|
||||
value = this._map[key3] || null;
|
||||
value = this._map[key3];
|
||||
if (xref) {
|
||||
return xref.fetchIfRefAsync(value, suppressEncryption);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue