From: Dominik Stadler Date: Sat, 13 Feb 2016 21:29:46 +0000 (+0000) Subject: Regression analysis: the additional testing of cloning sheets showed a X-Git-Tag: REL_3_14_FINAL~42 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=115b5fa0c65b30eee57584be99d0a3af73458230;p=poi.git Regression analysis: the additional testing of cloning sheets showed a possible ArrayIndexOutOfBounds error which we can avoid to make cloning fail a bit less. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1730274 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java b/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java index c40f45e964..8b3b980fc8 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java @@ -214,9 +214,11 @@ public class HSSFPicture extends HSSFSimpleShape implements Picture { void afterInsert(HSSFPatriarch patriarch) { EscherAggregate agg = patriarch.getBoundAggregate(); agg.associateShapeToObjRecord(getEscherContainer().getChildById(EscherClientDataRecord.RECORD_ID), getObjRecord()); - EscherBSERecord bse = - patriarch.getSheet().getWorkbook().getWorkbook().getBSERecord(getPictureIndex()); - bse.setRef(bse.getRef() + 1); + if(getPictureIndex() != -1) { + EscherBSERecord bse = + patriarch.getSheet().getWorkbook().getWorkbook().getBSERecord(getPictureIndex()); + bse.setRef(bse.getRef() + 1); + } } /** diff --git a/test-data/spreadsheet/florida_data.ashx.xls b/test-data/spreadsheet/florida_data.ashx.xls new file mode 100644 index 0000000000..5e45feac32 Binary files /dev/null and b/test-data/spreadsheet/florida_data.ashx.xls differ