mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-08 19:08:50 +00:00
AbstractHafasClientInterfaceProvider: make <dirTxt> in <jnyL> elements optional
This commit is contained in:
parent
3f2e07ed9c
commit
0c7c97c78a
1 changed files with 3 additions and 3 deletions
|
@ -396,18 +396,18 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
|
||||||
if (!equivs && !location.id.equals(stationId))
|
if (!equivs && !location.id.equals(stationId))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
final String jnyDirTxt = jny.getString("dirTxt");
|
final String jnyDirTxt = jny.optString("dirTxt", null);
|
||||||
Location destination = null;
|
Location destination = null;
|
||||||
// if last entry in stopL happens to be our destination, use it
|
// if last entry in stopL happens to be our destination, use it
|
||||||
final JSONArray stopList = jny.optJSONArray("stopL");
|
final JSONArray stopList = jny.optJSONArray("stopL");
|
||||||
if (stopList != null) {
|
if (stopList != null) {
|
||||||
final int lastStopIdx = stopList.getJSONObject(stopList.length() - 1).getInt("locX");
|
final int lastStopIdx = stopList.getJSONObject(stopList.length() - 1).getInt("locX");
|
||||||
final String lastStopName = locList.getJSONObject(lastStopIdx).getString("name");
|
final String lastStopName = locList.getJSONObject(lastStopIdx).getString("name");
|
||||||
if (jnyDirTxt.equals(lastStopName))
|
if (jnyDirTxt != null && jnyDirTxt.equals(lastStopName))
|
||||||
destination = parseLoc(locList, lastStopIdx, null, crdSysList);
|
destination = parseLoc(locList, lastStopIdx, null, crdSysList);
|
||||||
}
|
}
|
||||||
// otherwise split unidentified destination as if it was a station and use it
|
// otherwise split unidentified destination as if it was a station and use it
|
||||||
if (destination == null) {
|
if (destination == null && jnyDirTxt != null) {
|
||||||
final String[] splitJnyDirTxt = splitStationName(jnyDirTxt);
|
final String[] splitJnyDirTxt = splitStationName(jnyDirTxt);
|
||||||
destination = new Location(LocationType.ANY, null, splitJnyDirTxt[0], splitJnyDirTxt[1]);
|
destination = new Location(LocationType.ANY, null, splitJnyDirTxt[0], splitJnyDirTxt[1]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue