mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-07 07:35:46 +02:00
Avoid resolving an objId more than once in the PDFObjects class
Trying to resolve the same `objId` more than once would be a bug elsewhere in the code-base, since that should never happen, hence update the `resolve` method to prevent that.
This commit is contained in:
parent
918a319de6
commit
cb2ae021ca
@ -100,6 +100,9 @@ class PDFObjects {
|
|||||||
*/
|
*/
|
||||||
resolve(objId, data = null) {
|
resolve(objId, data = null) {
|
||||||
const obj = this.#ensureObj(objId);
|
const obj = this.#ensureObj(objId);
|
||||||
|
if (obj.data !== INITIAL_DATA) {
|
||||||
|
throw new Error(`Object already resolved ${objId}.`);
|
||||||
|
}
|
||||||
obj.data = data;
|
obj.data = data;
|
||||||
obj.resolve();
|
obj.resolve();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user