Fix bug #51950 - XWPF may not always have footnotes in a document

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1179449 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2011-10-05 21:26:49 +00:00
parent 0d31a3b8b7
commit 31924dff8b
2 changed files with 9 additions and 3 deletions

View File

@ -34,6 +34,7 @@
<changes>
<release version="3.8-beta5" date="2011-??-??">
<action dev="poi-developers" type="fix">51950 - XWPF fix for footnotes not always being present in a document</action>
<action dev="poi-developers" type="fix">51963 - Correct AreaReference handling of references containing a sheet name which includes a comma</action>
<action dev="poi-developers" type="fix">51955 - XSSFReader supplied StylesTables need to have the theme data available</action>
<action dev="poi-developers" type="fix">51716 - Removed incorrect assert in SXSSFSheet#getSXSSFSheet</action>

View File

@ -351,15 +351,20 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
}
public XWPFFootnote getFootnoteByID(int id) {
return footnotes.getFootnoteById(id);
if(footnotes == null) return null;
return footnotes.getFootnoteById(id);
}
public XWPFFootnote getEndnoteByID(int id) {
return endnotes.get(id);
if(endnotes == null) return null;
return endnotes.get(id);
}
public List<XWPFFootnote> getFootnotes() {
return footnotes.getFootnotesList();
if(footnotes == null) {
return Collections.emptyList();
}
return footnotes.getFootnotesList();
}
public XWPFHyperlink[] getHyperlinks() {