aboutsummaryrefslogtreecommitdiff
path: root/lib/docx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/docx')
-rw-r--r--lib/docx/body-reader.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js
index 0d04ccd..4bd38a9 100644
--- a/lib/docx/body-reader.js
+++ b/lib/docx/body-reader.js
@@ -462,7 +462,12 @@ function BodyReader(options) {
function readBlip(element, blip) {
var properties = element.first("wp:docPr").attributes;
var altText = isBlank(properties.descr) ? properties.title : properties.descr;
- return readImage(findBlipImageFile(blip), altText);
+ var blipImageFile = findBlipImageFile(blip);
+ if (blipImageFile === null) {
+ return emptyResultWithMessages([warning("Could not find image file for a:blip element")]);
+ } else {
+ return readImage(blipImageFile, altText);
+ }
}
function isBlank(value) {
@@ -474,12 +479,14 @@ function BodyReader(options) {
var linkRelationshipId = blip.attributes["r:link"];
if (embedRelationshipId) {
return findEmbeddedImageFile(embedRelationshipId);
- } else {
+ } else if (linkRelationshipId) {
var imagePath = relationships.findTargetByRelationshipId(linkRelationshipId);
return {
path: imagePath,
read: files.read.bind(files, imagePath)
};
+ } else {
+ return null;
}
}