Bug 66425: Avoid a NullPointerException found via oss-fuzz

We try to avoid throwing NullPointerException, but it was possible
to trigger one here with a specially crafted input-file

Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61644

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911842 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2023-08-22 14:22:06 +00:00
parent 5a4193b14d
commit 1b88529d07
2 changed files with 3 additions and 1 deletions

View File

@ -57,8 +57,10 @@ public abstract class XWPFAbstractFootnotesEndnotes extends POIXMLDocumentPart {
public XWPFAbstractFootnoteEndnote getFootnoteById(int id) {
for (XWPFAbstractFootnoteEndnote note : listFootnote) {
if (note.getCTFtnEdn().getId().intValue() == id)
if (note.getCTFtnEdn().getId() != null &&
note.getCTFtnEdn().getId().intValue() == id) {
return note;
}
}
return null;
}