aboutsummaryrefslogtreecommitdiff
path: root/lib/docx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-12-05 11:30:30 +0000
committerMichael Williamson <mike@zwobble.org>2026-12-05 11:30:30 +0000
commit39c18eb51cf1a0156b5e09ef2d68b5dee6f0680e (patch)
tree4d120413dd16e2ac71a43df58db35ed534159254 /lib/docx
parentae06a2bacfb74c88340e900e8a29336418936e9e (diff)
Handle main document part without a root element
Diffstat (limited to 'lib/docx')
-rw-r--r--lib/docx/docx-reader.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/docx/docx-reader.js b/lib/docx/docx-reader.js
index f343dae..9bca76b 100644
--- a/lib/docx/docx-reader.js
+++ b/lib/docx/docx-reader.js
@@ -74,6 +74,10 @@ function read(docxFile, input, options) {
};
}).then(function(result) {
return readXmlFileWithBody(result.partPaths.mainDocument, result, function(bodyReader, xml) {
+ if (xml === null) {
+ throw new Error("Main document part is missing root element. Are you sure this is a valid .docx file?");
+ }
+
return result.notes.flatMap(function(notes) {
return result.comments.flatMap(function(comments) {
var reader = new DocumentXmlReader({