Fix null pointer

This commit is contained in:
Victor Shcherb 2012-06-27 23:54:55 +02:00
parent 4653cf4c50
commit bbed3776a4

View file

@ -602,17 +602,20 @@ public class IndexAddressCreator extends AbstractIndexPartCreator{
boolean found = false;
Boundary cityBoundary = cityBoundaries.get(city);
if (cityBoundary != null) {
for(City subpart : boundariesToCities.get(cityBoundary)){
if(subpart != city){
List<City> subcities = boundariesToCities.get(cityBoundary);
if (subcities != null) {
for (City subpart : subcities) {
if (subpart != city) {
Boundary subBoundary = cityBoundaries.get(subpart);
if(cityBoundary != null && subBoundary != null && subBoundary.getAdminLevel() > cityBoundary.getAdminLevel()){
cityPart = findNearestCityOrSuburb(subBoundary, location); //subpart.getName();
if (cityBoundary != null && subBoundary != null && subBoundary.getAdminLevel() > cityBoundary.getAdminLevel()) {
cityPart = findNearestCityOrSuburb(subBoundary, location); // subpart.getName();
found = true;
break;
}
}
}
}
}
if (!found) {
Boundary b = cityBoundaries.get(city);
cityPart = findNearestCityOrSuburb(b, location);