fixed NPE

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@518 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach@gmail.com 2011-03-03 07:53:40 +00:00
parent 1c794932ef
commit bfa102fa11

View file

@ -808,12 +808,22 @@ public abstract class AbstractHafasProvider implements NetworkProvider
protected String normalizeLine(final String type, final String line)
{
final Matcher m = P_NORMALIZE_LINE.matcher(line);
final String strippedLine = m.matches() ? m.group(1) + m.group(2) : line;
final char normalizedType = normalizeType(type);
if (normalizedType != 0)
return normalizedType + strippedLine;
{
if (line != null)
{
final Matcher m = P_NORMALIZE_LINE.matcher(line);
final String strippedLine = m.matches() ? m.group(1) + m.group(2) : line;
return normalizedType + strippedLine;
}
else
{
return Character.toString(normalizedType);
}
}
throw new IllegalStateException("cannot normalize type '" + type + "' line '" + line + "'");
}