fixed IndexOutOfBoundsException when no intermediate stops present

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@577 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach@gmail.com 2011-04-29 11:23:27 +00:00
parent f06e30063c
commit 3ae140d60f

View file

@ -1611,12 +1611,17 @@ public abstract class AbstractEfaProvider implements NetworkProvider
XmlPullUtil.exit(pp, "itdStopSeq"); XmlPullUtil.exit(pp, "itdStopSeq");
// remove first and last, because they are not intermediate // remove first and last, because they are not intermediate
if (intermediateStops.get(0).location.id != departureId) final int size = intermediateStops.size();
throw new IllegalStateException(); if (size >= 2)
if (intermediateStops.get(intermediateStops.size() - 1).location.id != arrivalId) {
throw new IllegalStateException(); if (intermediateStops.get(size - 1).location.id != arrivalId)
intermediateStops.remove(0); throw new IllegalStateException();
intermediateStops.remove(intermediateStops.size() - 1); intermediateStops.remove(size - 1);
if (intermediateStops.get(0).location.id != departureId)
throw new IllegalStateException();
intermediateStops.remove(0);
}
} }
List<Point> path = null; List<Point> path = null;