poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1782897 - /poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java
Date Tue, 14 Feb 2017 00:18:13 GMT
Author: kiwiwings
Date: Tue Feb 14 00:18:13 2017
New Revision: 1782897

URL: http://svn.apache.org/viewvc?rev=1782897&view=rev
Log:
Metro shapes: integration test regression on empty paragraphs

Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java?rev=1782897&r1=1782896&r2=1782897&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java Tue Feb 14
00:18:13 2017
@@ -18,6 +18,7 @@
 package org.apache.poi.hslf.usermodel;
 
 import java.awt.Color;
+import java.util.List;
 
 import org.apache.poi.hslf.exceptions.HSLFException;
 import org.apache.poi.hslf.model.textproperties.BitMaskTextProp;
@@ -445,11 +446,14 @@ public final class HSLFTextRun implement
 
         if (ts.getSheet() instanceof MasterSheet) {
             TextShape<?,? extends TextParagraph<?,?,? extends TextRun>> ms =
ts.getMetroShape();
-            if (ms == null) {
+            if (ms == null || ms.getTextParagraphs().isEmpty()) {
                 return null;
             }
-            TextRun tr = ms.getTextParagraphs().get(0).getTextRuns().get(0);
-            return tr.getFieldType();
+            List<? extends TextRun> trList = ms.getTextParagraphs().get(0).getTextRuns();
+            if (trList.isEmpty()) {
+                return null;
+            }
+            return trList.get(0).getFieldType();
         }
         
         return null;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message