PassList is optional

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@649 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach@gmail.com 2011-05-17 08:45:54 +00:00
parent 52a57e2f25
commit d47a5ac9d2

View file

@ -720,7 +720,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
Location destination = null; Location destination = null;
int min = 0; int min = 0;
final List<Stop> intermediateStops = new LinkedList<Stop>(); List<Stop> intermediateStops = null;
final String tag = pp.getName(); final String tag = pp.getName();
if (tag.equals("Journey")) if (tag.equals("Journey"))
@ -760,6 +760,10 @@ public abstract class AbstractHafasProvider implements NetworkProvider
} }
XmlPullUtil.exit(pp, "JourneyAttributeList"); XmlPullUtil.exit(pp, "JourneyAttributeList");
if (XmlPullUtil.test(pp, "PassList"))
{
intermediateStops = new LinkedList<Stop>();
XmlPullUtil.enter(pp, "PassList"); XmlPullUtil.enter(pp, "PassList");
while (XmlPullUtil.test(pp, "BasicStop")) while (XmlPullUtil.test(pp, "BasicStop"))
{ {
@ -787,6 +791,8 @@ public abstract class AbstractHafasProvider implements NetworkProvider
} }
XmlPullUtil.exit(pp, "PassList"); XmlPullUtil.exit(pp, "PassList");
}
XmlPullUtil.exit(pp, "Journey"); XmlPullUtil.exit(pp, "Journey");
if (category == null) if (category == null)
@ -829,7 +835,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
XmlPullUtil.exit(pp, "Arrival"); XmlPullUtil.exit(pp, "Arrival");
// remove last intermediate // remove last intermediate
final int size = intermediateStops.size(); final int size = intermediateStops != null ? intermediateStops.size() : 0;
if (size >= 1) if (size >= 1)
if (intermediateStops.get(size - 1).location.id == sectionArrival.id) if (intermediateStops.get(size - 1).location.id == sectionArrival.id)
intermediateStops.remove(size - 1); intermediateStops.remove(size - 1);