mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-21 01:39:51 +00:00
Negentwee: Fix exception for locations without name.
This commit is contained in:
parent
aa16ed80b8
commit
79e8470284
1 changed files with 11 additions and 9 deletions
|
@ -517,23 +517,25 @@ public class NegentweeProvider extends AbstractNetworkProvider {
|
||||||
JSONObject place = location.optJSONObject("place");
|
JSONObject place = location.optJSONObject("place");
|
||||||
|
|
||||||
String locationType = location.getString("type");
|
String locationType = location.getString("type");
|
||||||
String locationName = location.getString("name");
|
String locationName = location.optString("name", null);
|
||||||
|
|
||||||
if (locationType.equals("address")) {
|
if (locationName != null) {
|
||||||
String houseNumber = location.optString("houseNr");
|
if (addTypePrefix && !location.isNull(locationType + "Type") && !locationType.equals("poi")) {
|
||||||
if (!houseNumber.isEmpty()) {
|
locationName = location.getString(locationType + "Type") + " " + locationName;
|
||||||
locationName = locationName + " " + houseNumber;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (addTypePrefix && !location.isNull(locationType + "Type") && !locationType.equals("poi")) {
|
if (locationType.equals("address")) {
|
||||||
locationName = location.getString(locationType + "Type") + " " + locationName;
|
String houseNumber = location.optString("houseNr");
|
||||||
|
if (!houseNumber.isEmpty()) {
|
||||||
|
locationName = locationName + " " + houseNumber;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Point locationPoint = Point.fromDouble(latlon.getDouble("lat"), latlon.getDouble("long"));
|
Point locationPoint = Point.fromDouble(latlon.getDouble("lat"), latlon.getDouble("long"));
|
||||||
|
|
||||||
return new Location(locationTypeFromTypeString(locationType), location.getString("id"), locationPoint.lat,
|
return new Location(locationTypeFromTypeString(locationType), location.getString("id"), locationPoint.lat,
|
||||||
locationPoint.lon, !(place == null) ? place.getString("name") : null, locationName, null);
|
locationPoint.lon, !(place == null) ? place.optString("name", null) : null, locationName, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Location> solveAmbiguousLocation(Location location) throws IOException {
|
private List<Location> solveAmbiguousLocation(Location location) throws IOException {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue