From: Maxim Valyanskiy Date: Fri, 19 Nov 2010 14:09:13 +0000 (+0000) Subject: hwpf: IndexOutOfBoundsException in Range.findRange when list contains only nulls X-Git-Tag: REL_3_8_BETA1~129 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c8dae0aa6cbf9fd109fe7e8fa9b548618a1edd88;p=poi.git hwpf: IndexOutOfBoundsException in Range.findRange when list contains only nulls git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1036850 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java index 45eee75e48..74fc4357cb 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java @@ -973,6 +973,11 @@ public class Range { // TODO -instantiable superclass while (node==null || (node.getEnd() <= start && x < rpl.size() - 1)) { x++; + + if (x>=rpl.size()) { + return new int[] {0, 0}; + } + node = rpl.get(x); }