Fix exception

This commit is contained in:
Victor Shcherb 2017-02-08 22:02:47 +01:00
parent 9dd0855d5a
commit d60b22de0c

View file

@ -44,12 +44,17 @@ public class RouteSegmentResult {
int end = Math.max(startPointIndex, endPointIndex);
float[] res = new float[(end - st + 1) * 2];
for (int k = 0; k < res.length / 2; k++) {
int ind = reverse ? (2 * (end - k)) : (2 * (k + st));
if (k == 0) {
res[2 * k] = 0;
} else {
res[2 * k] = pf[reverse ? (2 * (end - k)) : (2 * (k + st))];
if(ind < pf.length) {
res[2 * k] = pf[k];
}
}
if(ind < pf.length) {
res[2 * k + 1] = pf[ind + 1];
}
res[2 * k + 1] = pf[reverse ? (2 * (end - k) + 1) : (2 * (k + st) + 1)];
}
return res;
}