From 874fcccd78a2f0cc465580ec2cc21e3bc4d22790 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Tue, 18 Apr 2017 12:27:54 +0300 Subject: [PATCH] Fix search crash --- .../search/QuickSearchDialogFragment.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java index b5753dfae3..83e87a54aa 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java @@ -1308,20 +1308,20 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC } private void reloadHistoryInternal() { - try { - LOG.info("+++ start loading history"); - SearchResultCollection res = searchUICore.shallowSearch(SearchHistoryAPI.class, "", null); - List rows = new ArrayList<>(); - if (res != null) { - for (SearchResult sr : res.getCurrentSearchResults()) { - rows.add(new QuickSearchListItem(app, sr)); + if (historySearchFragment != null) { + try { + SearchResultCollection res = searchUICore.shallowSearch(SearchHistoryAPI.class, "", null); + List rows = new ArrayList<>(); + if (res != null) { + for (SearchResult sr : res.getCurrentSearchResults()) { + rows.add(new QuickSearchListItem(app, sr)); + } } + historySearchFragment.updateListAdapter(rows, false); + } catch (Exception e) { + e.printStackTrace(); + app.showToastMessage(e.getMessage()); } - historySearchFragment.updateListAdapter(rows, false); - LOG.info("--- history loaded: count=" + rows.size()); - } catch (IOException e) { - e.printStackTrace(); - app.showToastMessage(e.getMessage()); } }