aboutsummaryrefslogtreecommitdiff
path: root/lib/docx/body-reader.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2025-09-11 15:07:41 +0100
committerMichael Williamson <mike@zwobble.org>2025-09-11 15:07:41 +0100
commitcee62eea4e52484a473128f342e2a497e32261b7 (patch)
treec2d38753571a59f38c337edaac76d185a7e3601d /lib/docx/body-reader.js
parent660da135c950031097269f5d610e771698f99eb3 (diff)
Handle numbering levels defined without an index
Diffstat (limited to 'lib/docx/body-reader.js')
-rw-r--r--lib/docx/body-reader.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js
index 5cdb4ef..826424b 100644
--- a/lib/docx/body-reader.js
+++ b/lib/docx/body-reader.js
@@ -670,6 +670,13 @@ function readNumberingProperties(styleId, element, numbering) {
}
}
+ // Some malformed documents define numbering levels without an index, and
+ // reference the numbering using a w:numPr element without a w:ilvl child.
+ // To handle such cases, we assume a level of 0 as a fallback.
+ if (numId !== undefined) {
+ return numbering.findLevel(numId, "0");
+ }
+
return null;
}