Fix NPE
This commit is contained in:
parent
35e9fe255d
commit
a3e2982697
1 changed files with 16 additions and 12 deletions
|
@ -90,7 +90,7 @@ public class QuickSearchHelper implements ResourceListener {
|
|||
public void refreshCustomPoiFilters() {
|
||||
core.clearCustomSearchPoiFilters();
|
||||
PoiFiltersHelper poiFilters = app.getPoiFilters();
|
||||
for(CustomSearchPoiFilter udf : poiFilters.getUserDefinedPoiFilters()) {
|
||||
for (CustomSearchPoiFilter udf : poiFilters.getUserDefinedPoiFilters()) {
|
||||
core.addCustomSearchPoiFilter(udf, 0);
|
||||
}
|
||||
PoiUIFilter localWikiPoiFilter = poiFilters.getLocalWikiPOIFilter();
|
||||
|
@ -151,7 +151,7 @@ public class QuickSearchHelper implements ResourceListener {
|
|||
|
||||
@Override
|
||||
public int getSearchPriority(SearchPhrase p) {
|
||||
if(!p.isNoSelectedType()) {
|
||||
if (!p.isNoSelectedType()) {
|
||||
return -1;
|
||||
}
|
||||
return SEARCH_WPT_API_PRIORITY;
|
||||
|
@ -265,7 +265,7 @@ public class QuickSearchHelper implements ResourceListener {
|
|||
if (p.isLastWord(ObjectType.FAVORITE_GROUP)) {
|
||||
return SEARCH_FAVORITE_API_PRIORITY;
|
||||
}
|
||||
if(!p.isNoSelectedType() || !p.isUnknownSearchWordPresent()) {
|
||||
if (!p.isNoSelectedType() || !p.isUnknownSearchWordPresent()) {
|
||||
return -1;
|
||||
}
|
||||
return SEARCH_FAVORITE_API_PRIORITY;
|
||||
|
@ -288,8 +288,13 @@ public class QuickSearchHelper implements ResourceListener {
|
|||
@Override
|
||||
public boolean search(SearchPhrase phrase, SearchUICore.SearchResultMatcher resultMatcher) throws IOException {
|
||||
List<Amenity> amenities = new ArrayList<>();
|
||||
amenities.addAll(nominatimPoiFilter.initializeNewSearch(app.getSettings().getLastKnownMapLocation().getLatitude(), app.getSettings().getLastKnownMapLocation().getLongitude(), -1, null));
|
||||
amenities.addAll(nominatimAddressFilter.initializeNewSearch(app.getSettings().getLastKnownMapLocation().getLatitude(), app.getSettings().getLastKnownMapLocation().getLongitude(), -1, null));
|
||||
double lat = app.getSettings().getLastKnownMapLocation().getLatitude();
|
||||
double lon = app.getSettings().getLastKnownMapLocation().getLongitude();
|
||||
String text = phrase.getUnknownSearchPhrase();
|
||||
nominatimPoiFilter.setFilterByName(text);
|
||||
nominatimAddressFilter.setFilterByName(text);
|
||||
amenities.addAll(nominatimPoiFilter.initializeNewSearch(lat, lon, -1, null));
|
||||
amenities.addAll(nominatimAddressFilter.initializeNewSearch(lat, lon, -1, null));
|
||||
int p = 0;
|
||||
for (Amenity amenity : amenities) {
|
||||
SearchResult sr = new SearchResult(phrase);
|
||||
|
@ -307,7 +312,6 @@ public class QuickSearchHelper implements ResourceListener {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class SearchHistoryAPI extends SearchBaseAPI {
|
||||
|
|
Loading…
Reference in a new issue