Fix geocoding crash
This commit is contained in:
parent
30ea0c5e6c
commit
c21c8ad903
1 changed files with 36 additions and 28 deletions
|
@ -77,7 +77,7 @@ public class CurrentPositionHelper implements ResourceListener {
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
try {
|
try {
|
||||||
processGeocoding(loc, geoCoding, storeFound, result);
|
processGeocoding(loc, geoCoding, storeFound, result);
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -111,6 +111,7 @@ public class CurrentPositionHelper implements ResourceListener {
|
||||||
protected void justifyResult(List<GeocodingResult> res, final ResultMatcher<GeocodingResult> result) {
|
protected void justifyResult(List<GeocodingResult> res, final ResultMatcher<GeocodingResult> result) {
|
||||||
List<GeocodingResult> complete = new ArrayList<>();
|
List<GeocodingResult> complete = new ArrayList<>();
|
||||||
double minBuildingDistance = 0;
|
double minBuildingDistance = 0;
|
||||||
|
if (res != null) {
|
||||||
for (GeocodingResult r : res) {
|
for (GeocodingResult r : res) {
|
||||||
Collection<RegionAddressRepository> rar = app.getResourceManager().getAddressRepositories();
|
Collection<RegionAddressRepository> rar = app.getResourceManager().getAddressRepositories();
|
||||||
RegionAddressRepository foundRepo = null;
|
RegionAddressRepository foundRepo = null;
|
||||||
|
@ -146,6 +147,8 @@ public class CurrentPositionHelper implements ResourceListener {
|
||||||
complete.add(r);
|
complete.add(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (result.isCancelled()) {
|
if (result.isCancelled()) {
|
||||||
app.runInUIThread(new Runnable() {
|
app.runInUIThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -225,7 +228,12 @@ public class CurrentPositionHelper implements ResourceListener {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
return new GeocodingUtilities().reverseGeocodingSearch(geocoding ? defCtx : ctx, lat, lon);
|
return new GeocodingUtilities().reverseGeocodingSearch(geocoding ? defCtx : ctx, lat, lon);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue