Avoid NPE with broken files when writing endnotes for Word documents

Fixes https://issues.oss-fuzz.com/issues/392690733
This commit is contained in:
Dominik Stadler 2026-01-09 08:07:56 +01:00
parent befc941dcf
commit e9b33c0b08
3 changed files with 5 additions and 0 deletions

View File

@ -123,6 +123,11 @@ public class XWPFEndnotes extends XWPFAbstractFootnotesEndnotes {
@Override
protected void commit() throws IOException {
// cannot save anything if class is not initialized fully
if (ctEndnotes == null) {
return;
}
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTEndnotes.type.getName().getNamespaceURI(), "endnotes"));
PackagePart part = getPackagePart();

Binary file not shown.