fixed NPE

This commit is contained in:
Andreas Schildbach 2012-04-10 00:35:20 +02:00
parent 79608200a9
commit 33a804ab3f
2 changed files with 19 additions and 6 deletions

View file

@ -1881,13 +1881,16 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
protected Line parseLine(final String type, final String line, final boolean wheelchairAccess)
{
final Matcher mBus = P_NORMALIZE_LINE_BUS.matcher(line);
if (mBus.matches())
return newLine('B' + mBus.group(1));
if (line != null)
{
final Matcher mBus = P_NORMALIZE_LINE_BUS.matcher(line);
if (mBus.matches())
return newLine('B' + mBus.group(1));
final Matcher mTram = P_NORMALIZE_LINE_TRAM.matcher(line);
if (mTram.matches())
return newLine('T' + mTram.group(1));
final Matcher mTram = P_NORMALIZE_LINE_TRAM.matcher(line);
if (mTram.matches())
return newLine('T' + mTram.group(1));
}
final char normalizedType = normalizeType(type);
if (normalizedType == 0)

View file

@ -143,4 +143,14 @@ public class RtProviderLiveTest extends AbstractProviderLiveTest
final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true);
System.out.println(laterResult);
}
@Test
public void crossStateConnection() throws Exception
{
final QueryConnectionsResult result = queryConnections(new Location(LocationType.STATION, 8000207, null, "Köln Hbf"), null, new Location(
LocationType.STATION, 6096001, null, "DUBLIN"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL, Accessibility.NEUTRAL);
System.out.println(result);
final QueryConnectionsResult laterResult = queryMoreConnections(result.context, true);
System.out.println(laterResult);
}
}