Merge pull request #12720 from calixteman/fix_co
Be sure that CalculationOrder is either null or a non-empty array
This commit is contained in:
commit
7097114e0c
@ -1050,6 +1050,9 @@ class PDFDocument {
|
||||
}
|
||||
|
||||
const ids = calculationOrder.filter(isRef).map(ref => ref.toString());
|
||||
if (ids.length === 0) {
|
||||
return shadow(this, "calculationOrderIds", null);
|
||||
}
|
||||
return shadow(this, "calculationOrderIds", ids);
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ class EventDispatcher {
|
||||
}
|
||||
|
||||
calculateNow() {
|
||||
if (this._calculationOrder.length === 0) {
|
||||
if (!this._calculationOrder) {
|
||||
return;
|
||||
}
|
||||
const first = this._calculationOrder[0];
|
||||
@ -160,7 +160,7 @@ class EventDispatcher {
|
||||
}
|
||||
|
||||
runCalculate(source, event) {
|
||||
if (this._calculationOrder.length === 0) {
|
||||
if (!this._calculationOrder) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -187,6 +187,14 @@ describe("document", function () {
|
||||
acroForm.set("CO", []);
|
||||
pdfDocument = getDocument(acroForm);
|
||||
expect(pdfDocument.calculationOrderIds).toEqual(null);
|
||||
|
||||
acroForm.set("CO", ["1", "2"]);
|
||||
pdfDocument = getDocument(acroForm);
|
||||
expect(pdfDocument.calculationOrderIds).toEqual(null);
|
||||
|
||||
acroForm.set("CO", ["1", Ref.get(1, 0), "2"]);
|
||||
pdfDocument = getDocument(acroForm);
|
||||
expect(pdfDocument.calculationOrderIds).toEqual(["1R"]);
|
||||
});
|
||||
|
||||
it("should get field objects array or null", async function () {
|
||||
|
Loading…
Reference in New Issue
Block a user