Browse Source

Bug 66425: Avoid NullPointerExceptions found via poi-fuzz

We try to avoid throwing NullPointerException, but it was possible
to trigger one here

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912303 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_5_2_4
Dominik Stadler 7 months ago
parent
commit
e9b860f6d4

+ 2
- 1
poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java View File

@@ -1430,8 +1430,9 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun {
}
if (o instanceof CTFtnEdnRef) {
CTFtnEdnRef ftn = (CTFtnEdnRef) o;
final int i = ftn.getId() == null ? -1 : ftn.getId().intValue();
String footnoteRef = ftn.getDomNode().getLocalName().equals("footnoteReference") ?
"[footnoteRef:" + ftn.getId().intValue() + "]" : "[endnoteRef:" + ftn.getId().intValue() + "]";
"[footnoteRef:" + i + "]" : "[endnoteRef:" + i + "]";
text.append(footnoteRef);
}
}

BIN
test-data/document/crash-517626e815e0afa9decd0ebb6d1dee63fb9907dd.docx View File


Loading…
Cancel
Save