From cb2ae021ca8094aa5b4d2e9038f535c3a1c3b53c Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 22 Mar 2026 11:05:43 +0100 Subject: [PATCH] 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. --- src/display/pdf_objects.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/display/pdf_objects.js b/src/display/pdf_objects.js index eccbe6a72..5f8edd82c 100644 --- a/src/display/pdf_objects.js +++ b/src/display/pdf_objects.js @@ -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(); }