aboutsummaryrefslogtreecommitdiff
path: root/mammoth/docx/body_xml.py
diff options
context:
space:
mode:
Diffstat (limited to 'mammoth/docx/body_xml.py')
-rw-r--r--mammoth/docx/body_xml.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py
index d3dd267..e2a490a 100644
--- a/mammoth/docx/body_xml.py
+++ b/mammoth/docx/body_xml.py
@@ -288,6 +288,12 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f
if level is not None:
return level
+ # 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 num_id is not None:
+ return numbering.find_level(num_id, "0")
+
return None
def _read_paragraph_indent(element):