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()) if (location.hasId())
return location; return location;
if (location.hasName()) { if (location.hasName()) {
final List<Location> locations = jsonLocMatch(JOINER.join(location.place, location.name), null, 1) final SuggestLocationsResult result = jsonLocMatch(JOINER.join(location.place, location.name), null, 1);
.getLocations(); if (result.status == SuggestLocationsResult.Status.OK) {
final List<Location> locations = result.getLocations();
if (!locations.isEmpty()) if (!locations.isEmpty())
return locations.get(0); return locations.get(0);
} }
}
if (location.hasCoord()) { if (location.hasCoord()) {
final List<Location> locations = jsonLocGeoPos(EnumSet.allOf(LocationType.class), location.coord, 0, final NearbyLocationsResult result = jsonLocGeoPos(EnumSet.allOf(LocationType.class), location.coord, 0, 1);
1).locations; if (result.status == NearbyLocationsResult.Status.OK) {
final List<Location> locations = result.locations;
if (!locations.isEmpty()) if (!locations.isEmpty())
return locations.get(0); return locations.get(0);
} }
}
return null; return null;
} }