From ed6b3a42bd63774fdf018d65989cb50c33fa2ee5 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 11 May 2021 22:32:40 +0100 Subject: Handle w:num with invalid w:abstractNumId --- mammoth/docx/numbering_xml.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mammoth') 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) -- cgit v1.2.3