From 245d9ba925a6840ab248d53cebdbeb7b54f22073 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 14 Apr 2025 09:58:15 +0200 Subject: [PATCH] Ensure that "local" /Contents stream-dict /Resources aren't empty (PR 19803 follow-up) This is a small, and quite possibly pointless, optimization which ensures that any "local" /Resources aren't empty, to avoid needlessly trying to load and merge dictionaries. --- src/core/document.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/document.js b/src/core/document.js index b1e1caaec..7b6249385 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -427,7 +427,7 @@ class Page { // available (see issue18894.pdf). const localResources = streamDict?.get("Resources"); - if (!(localResources instanceof Dict)) { + if (!(localResources instanceof Dict && localResources.size)) { return this.resources; } const objectLoader = new ObjectLoader(localResources, keys, this.xref);