aboutsummaryrefslogtreecommitdiff
path: root/lib/docx/document-xml-reader.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/docx/document-xml-reader.js')
-rw-r--r--lib/docx/document-xml-reader.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/docx/document-xml-reader.js b/lib/docx/document-xml-reader.js
index c5472c2..9543ed8 100644
--- a/lib/docx/document-xml-reader.js
+++ b/lib/docx/document-xml-reader.js
@@ -10,6 +10,10 @@ function DocumentXmlReader(options) {
function convertXmlToDocument(element) {
var body = element.first("w:body");
+ if (body == null) {
+ throw new Error("Could not find the body element: are you sure this is a docx file?");
+ }
+
var result = bodyReader.readXmlElements(body.children)
.map(function(children) {
return new documents.Document(children, {