aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2021-05-11 22:32:40 +0100
committerMichael Williamson <mike@zwobble.org>2021-05-11 22:32:40 +0100
commited6b3a42bd63774fdf018d65989cb50c33fa2ee5 (patch)
tree6fb975d253f1f2322b00612d732f8ed87b54c95d /mammoth
parent74f321ec965d5bdfff5849aad174f2b78188f45c (diff)
Handle w:num with invalid w:abstractNumId
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/docx/numbering_xml.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/mammoth/docx/numbering_xml.py b/mammoth/docx/numbering_xml.py
index e1ea0b4..7f7bf0e 100644
--- a/mammoth/docx/numbering_xml.py
+++ b/mammoth/docx/numbering_xml.py
@@ -91,8 +91,10 @@ class Numbering(object):
if num is None:
return None
else:
- abstract_num = self._abstract_nums[num.abstract_num_id]
- if abstract_num.num_style_link is None:
+ abstract_num = self._abstract_nums.get(num.abstract_num_id)
+ if abstract_num is None:
+ return None
+ elif abstract_num.num_style_link is None:
return self._to_numbering_level(abstract_num.levels.get(level))
else:
style = self._styles.find_numbering_style_by_id(abstract_num.num_style_link)