hwpf: Range.findRange fix for out-of-range searches

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@962520 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maxim Valyanskiy 2010-07-09 13:30:43 +00:00
parent 7aba97ba6e
commit 8c763967ab
1 changed files with 5 additions and 0 deletions

View File

@ -962,11 +962,16 @@ public class Range { // TODO -instantiable superclass
private int[] findRange(List rpl, int min, int start, int end) {
int x = min;
PropertyNode node = (PropertyNode) rpl.get(x);
while (node.getEnd() <= start && x < rpl.size() - 1) {
x++;
node = (PropertyNode) rpl.get(x);
}
if (node.getStart()>end) {
return new int[] {0, 0};
}
if (node.getEnd() <= start) {
return new int[] { rpl.size(), rpl.size() };
}