aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2015-09-05 12:57:04 +0000
committerDominik Stadler <centic@apache.org>2015-09-05 12:57:04 +0000
commit062cf73c0788702253ed9be4622c39af343b3f63 (patch)
tree2f6c0cae2369349f98ed4fcba07878760ae760d8 /src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java
parent7da84c99f2eb406119eb0d63daa41be62d8faa67 (diff)
downloadpoi-062cf73c0788702253ed9be4622c39af343b3f63.tar.gz
poi-062cf73c0788702253ed9be4622c39af343b3f63.zip
Bug 58315: Avoid NPE for RichTextString without font-details
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1701382 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java')
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java
index a7f9b3a8e3..63f7a3ba8f 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java
@@ -435,6 +435,11 @@ public class XSSFRichTextString implements RichTextString {
protected static CTFont toCTFont(CTRPrElt pr){
CTFont ctFont = CTFont.Factory.newInstance();
+ // Bug 58315: there are files where there is no pr-entry for a RichTextString
+ if(pr == null) {
+ return ctFont;
+ }
+
if(pr.sizeOfBArray() > 0) ctFont.addNewB().setVal(pr.getBArray(0).getVal());
if(pr.sizeOfUArray() > 0) ctFont.addNewU().setVal(pr.getUArray(0).getVal());
if(pr.sizeOfIArray() > 0) ctFont.addNewI().setVal(pr.getIArray(0).getVal());