From 43921c1a1965fc7d088ddd7018e9b4d66101e5c3 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Tue, 14 Feb 2017 00:18:13 +0000 Subject: [PATCH] Metro shapes: integration test regression on empty paragraphs git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1782897 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/hslf/usermodel/HSLFTextRun.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java index 540c92eb2..0d887a412 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java @@ -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> 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 trList = ms.getTextParagraphs().get(0).getTextRuns(); + if (trList.isEmpty()) { + return null; + } + return trList.get(0).getFieldType(); } return null;