]> source.dussan.org Git - poi.git/commitdiff
Metro shapes: integration test regression on empty paragraphs
authorAndreas Beeker <kiwiwings@apache.org>
Tue, 14 Feb 2017 00:18:13 +0000 (00:18 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Tue, 14 Feb 2017 00:18:13 +0000 (00:18 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1782897 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java

index 540c92eb2e2610018ddefa2f8ff5ba644acce29d..0d887a4120e072e8d082fdfa0d822311005c3ca2 100644 (file)
@@ -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 implements TextRun {
 
         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;