summaryrefslogtreecommitdiff
path: root/lib/docx/office-xml-reader.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-12-05 10:19:25 +0000
committerMichael Williamson <mike@zwobble.org>2026-12-05 10:19:25 +0000
commitae06a2bacfb74c88340e900e8a29336418936e9e (patch)
tree57f48a831f4c34fc45c5a18994007d8713393819 /lib/docx/office-xml-reader.js
parent5171a9072f8b7343ab1c9ed3a15d6d372cb59b67 (diff)
Handle XML documents that are missing a root element
Diffstat (limited to 'lib/docx/office-xml-reader.js')
-rw-r--r--lib/docx/office-xml-reader.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/docx/office-xml-reader.js b/lib/docx/office-xml-reader.js
index 792cd7c..6d2c1e9 100644
--- a/lib/docx/office-xml-reader.js
+++ b/lib/docx/office-xml-reader.js
@@ -38,7 +38,11 @@ var xmlNamespaceMap = {
function read(xmlString) {
return xml.readString(xmlString, xmlNamespaceMap)
.then(function(document) {
- return collapseAlternateContent(document)[0];
+ if (document === null) {
+ return null;
+ } else {
+ return collapseAlternateContent(document)[0];
+ }
});
}