Skip to content

Commit cb2ae02

Browse files
committed
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.
1 parent 918a319 commit cb2ae02

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/display/pdf_objects.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ class PDFObjects {
100100
*/
101101
resolve(objId, data = null) {
102102
const obj = this.#ensureObj(objId);
103+
if (obj.data !== INITIAL_DATA) {
104+
throw new Error(`Object already resolved ${objId}.`);
105+
}
103106
obj.data = data;
104107
obj.resolve();
105108
}

0 commit comments

Comments
 (0)