diff --git a/src/de/schildbach/pte/AbstractEfaProvider.java b/src/de/schildbach/pte/AbstractEfaProvider.java index 9d3e7c00..d5338a8c 100644 --- a/src/de/schildbach/pte/AbstractEfaProvider.java +++ b/src/de/schildbach/pte/AbstractEfaProvider.java @@ -1078,30 +1078,34 @@ public abstract class AbstractEfaProvider implements NetworkProvider if (XmlPullUtil.test(pp, "infoLink")) XmlPullUtil.next(pp); - XmlPullUtil.enter(pp, "itdStopSeq"); - final List intermediateStops = new LinkedList(); - while (XmlPullUtil.test(pp, "itdPoint")) + List intermediateStops = null; + if (XmlPullUtil.test(pp, "itdStopSeq")) { - final int stopId = Integer.parseInt(pp.getAttributeValue(null, "stopID")); - final String stopName = normalizeLocationName(pp.getAttributeValue(null, "name")); - final String stopPosition = normalizePlatform(pp.getAttributeValue(null, "platform"), pp.getAttributeValue(null, - "platformName")); - XmlPullUtil.enter(pp, "itdPoint"); - XmlPullUtil.require(pp, "itdDateTime"); - processItdDateTime(pp, stopTime); - XmlPullUtil.exit(pp, "itdPoint"); - intermediateStops.add(new Stop(new Location(LocationType.STATION, stopId, 0, 0, stopName), stopPosition, stopTime - .getTime())); - } - XmlPullUtil.exit(pp, "itdStopSeq"); + XmlPullUtil.enter(pp, "itdStopSeq"); + intermediateStops = new LinkedList(); + while (XmlPullUtil.test(pp, "itdPoint")) + { + final int stopId = Integer.parseInt(pp.getAttributeValue(null, "stopID")); + final String stopName = normalizeLocationName(pp.getAttributeValue(null, "name")); + final String stopPosition = normalizePlatform(pp.getAttributeValue(null, "platform"), pp.getAttributeValue(null, + "platformName")); + XmlPullUtil.enter(pp, "itdPoint"); + XmlPullUtil.require(pp, "itdDateTime"); + processItdDateTime(pp, stopTime); + XmlPullUtil.exit(pp, "itdPoint"); + intermediateStops.add(new Stop(new Location(LocationType.STATION, stopId, 0, 0, stopName), stopPosition, stopTime + .getTime())); + } + XmlPullUtil.exit(pp, "itdStopSeq"); - // remove first and last, because they are not intermediate - if (intermediateStops.get(0).location.id != departureId) - throw new IllegalStateException(); - if (intermediateStops.get(intermediateStops.size() - 1).location.id != arrivalId) - throw new IllegalStateException(); - intermediateStops.remove(0); - intermediateStops.remove(intermediateStops.size() - 1); + // remove first and last, because they are not intermediate + if (intermediateStops.get(0).location.id != departureId) + throw new IllegalStateException(); + if (intermediateStops.get(intermediateStops.size() - 1).location.id != arrivalId) + throw new IllegalStateException(); + intermediateStops.remove(0); + intermediateStops.remove(intermediateStops.size() - 1); + } parts.add(new Connection.Trip(line, lineColors(line), destinationId, destination, departureTime.getTime(), departurePosition, departureId, departure, arrivalTime.getTime(), arrivalPosition, arrivalId, arrival,