mirror of https://github.com/apache/poi.git
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:
parent
eb8d059cb9
commit
9b6bf64760
|
@ -962,11 +962,16 @@ public class Range { // TODO -instantiable superclass
|
||||||
private int[] findRange(List rpl, int min, int start, int end) {
|
private int[] findRange(List rpl, int min, int start, int end) {
|
||||||
int x = min;
|
int x = min;
|
||||||
PropertyNode node = (PropertyNode) rpl.get(x);
|
PropertyNode node = (PropertyNode) rpl.get(x);
|
||||||
|
|
||||||
while (node.getEnd() <= start && x < rpl.size() - 1) {
|
while (node.getEnd() <= start && x < rpl.size() - 1) {
|
||||||
x++;
|
x++;
|
||||||
node = (PropertyNode) rpl.get(x);
|
node = (PropertyNode) rpl.get(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node.getStart()>end) {
|
||||||
|
return new int[] {0, 0};
|
||||||
|
}
|
||||||
|
|
||||||
if (node.getEnd() <= start) {
|
if (node.getEnd() <= start) {
|
||||||
return new int[] { rpl.size(), rpl.size() };
|
return new int[] { rpl.size(), rpl.size() };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue