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:
Jonas Jenwald 2026-03-22 11:05:43 +01:00
parent 918a319de6
commit cb2ae021ca

View File

@ -100,6 +100,9 @@ class PDFObjects {
*/
resolve(objId, data = null) {
const obj = this.#ensureObj(objId);
if (obj.data !== INITIAL_DATA) {
throw new Error(`Object already resolved ${objId}.`);
}
obj.data = data;
obj.resolve();
}