diff --git a/src/java/org/apache/poi/hssf/model/Sheet.java b/src/java/org/apache/poi/hssf/model/Sheet.java index 555232ae6..63127a087 100644 --- a/src/java/org/apache/poi/hssf/model/Sheet.java +++ b/src/java/org/apache/poi/hssf/model/Sheet.java @@ -482,7 +482,7 @@ public class Sheet implements Model public MergeCellsRecord.MergedRegion getMergedRegionAt(int index) { //safety checks - if (index < numMergedRegions || mergedRecords.size() == 0) + if (index >= numMergedRegions || mergedRecords.size() == 0) return null; int pos = 0;