mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 08:49:58 +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");
|
||||
|
||||
String locationType = location.getString("type");
|
||||
String locationName = location.getString("name");
|
||||
String locationName = location.optString("name", null);
|
||||
|
||||
if (locationType.equals("address")) {
|
||||
String houseNumber = location.optString("houseNr");
|
||||
if (!houseNumber.isEmpty()) {
|
||||
locationName = locationName + " " + houseNumber;
|
||||
if (locationName != null) {
|
||||
if (addTypePrefix && !location.isNull(locationType + "Type") && !locationType.equals("poi")) {
|
||||
locationName = location.getString(locationType + "Type") + " " + locationName;
|
||||
}
|
||||
}
|
||||
|
||||
if (addTypePrefix && !location.isNull(locationType + "Type") && !locationType.equals("poi")) {
|
||||
locationName = location.getString(locationType + "Type") + " " + locationName;
|
||||
if (locationType.equals("address")) {
|
||||
String houseNumber = location.optString("houseNr");
|
||||
if (!houseNumber.isEmpty()) {
|
||||
locationName = locationName + " " + houseNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Point locationPoint = Point.fromDouble(latlon.getDouble("lat"), latlon.getDouble("long"));
|
||||
|
||||
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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue