diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java index 2acd39103c..563e7c8538 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java @@ -2373,14 +2373,15 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC .setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - if (getParentFragment() instanceof QuickSearchDialogFragment) { - QuickSearchDialogFragment parentFragment = (QuickSearchDialogFragment) getParentFragment(); - SearchHistoryHelper helper = SearchHistoryHelper.getInstance(parentFragment.getMyApplication()); + Fragment parentFragment = getParentFragment(); + if (parentFragment instanceof QuickSearchDialogFragment) { + QuickSearchDialogFragment searchDialogFragment = (QuickSearchDialogFragment) parentFragment; + SearchHistoryHelper helper = SearchHistoryHelper.getInstance(searchDialogFragment.getMyApplication()); for (QuickSearchListItem searchListItem : selectedItems) { helper.remove(searchListItem.getSearchResult().object); } - parentFragment.reloadHistory(); - parentFragment.enableSelectionMode(false, -1); + searchDialogFragment.reloadHistory(); + searchDialogFragment.enableSelectionMode(false, -1); } } })