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
This commit is contained in:
Dominik Stadler 2023-09-14 09:23:02 +00:00
parent cc4ccbae1d
commit e9b860f6d4
2 changed files with 2 additions and 1 deletions

View File

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