aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/docx/body_xml.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py
index fbf813c..b5e2997 100644
--- a/mammoth/docx/body_xml.py
+++ b/mammoth/docx/body_xml.py
@@ -329,8 +329,13 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f
return image_path, open_image
def read_imagedata(element):
- title = element.attributes.get("o:title")
- return _read_image(lambda: _find_embedded_image(element.attributes["r:id"]), title)
+ relationship_id = element.attributes.get("r:id")
+ if relationship_id is None:
+ warning = results.warning("A v:imagedata element without a relationship ID was ignored")
+ return _empty_result_with_message(warning)
+ else:
+ title = element.attributes.get("o:title")
+ return _read_image(lambda: _find_embedded_image(relationship_id), title)
def note_reference_reader(note_type):
def note_reference(element):