diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 5bccea9ae..1958a3520 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -1188,15 +1188,15 @@ class PartialEvaluator { break; } } - return promise.then(function () { - if (gStateObj.length > 0) { - operatorList.addOp(OPS.setGState, [gStateObj]); - } + await promise; - if (isSimpleGState) { - localGStateCache.set(cacheKey, gStateRef, gStateObj); - } - }); + if (gStateObj.length > 0) { + operatorList.addOp(OPS.setGState, [gStateObj]); + } + + if (isSimpleGState) { + localGStateCache.set(cacheKey, gStateRef, gStateObj); + } } loadFont(