diff options
author | Dominik Stadler <centic@apache.org> | 2016-02-13 21:29:46 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2016-02-13 21:29:46 +0000 |
commit | 115b5fa0c65b30eee57584be99d0a3af73458230 (patch) | |
tree | 3ce74c1a914eb52dd4df322c3730c5c69b3bfade /src | |
parent | 23be95a4744889226e459b63d2886f60a28b6199 (diff) | |
download | poi-115b5fa0c65b30eee57584be99d0a3af73458230.tar.gz poi-115b5fa0c65b30eee57584be99d0a3af73458230.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java | 8 |
1 files changed, 5 insertions, 3 deletions
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); + } } /** |