AbstractHafasClientInterfaceProvider: Test for OK status of results in jsonTripSearchIdentify().

This commit is contained in:
Andreas Schildbach 2018-12-10 10:53:09 +01:00
parent 4e9ff4d9da
commit a776a0ae89

View file

@ -434,17 +434,21 @@ public abstract class AbstractHafasClientInterfaceProvider extends AbstractHafas
if (location.hasId())
return location;
if (location.hasName()) {
final List<Location> locations = jsonLocMatch(JOINER.join(location.place, location.name), null, 1)
.getLocations();
final SuggestLocationsResult result = jsonLocMatch(JOINER.join(location.place, location.name), null, 1);
if (result.status == SuggestLocationsResult.Status.OK) {
final List<Location> locations = result.getLocations();
if (!locations.isEmpty())
return locations.get(0);
}
}
if (location.hasCoord()) {
final List<Location> locations = jsonLocGeoPos(EnumSet.allOf(LocationType.class), location.coord, 0,
1).locations;
final NearbyLocationsResult result = jsonLocGeoPos(EnumSet.allOf(LocationType.class), location.coord, 0, 1);
if (result.status == NearbyLocationsResult.Status.OK) {
final List<Location> locations = result.locations;
if (!locations.isEmpty())
return locations.get(0);
}
}
return null;
}