Fix possible npe
This commit is contained in:
parent
5a6540b10b
commit
d791e9eb5d
2 changed files with 10 additions and 17 deletions
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.search;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
@ -26,10 +27,10 @@ import android.widget.TextView;
|
|||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.DialogListItemAdapter;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
|
@ -170,8 +171,9 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
|||
public void onDismiss(DialogInterface dialog) {
|
||||
if (editMode) {
|
||||
QuickSearchDialogFragment quickSearchDialogFragment = getQuickSearchDialogFragment();
|
||||
if (quickSearchDialogFragment != null) {
|
||||
getMyApplication().getSearchUICore().refreshCustomPoiFilters();
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app != null && quickSearchDialogFragment != null) {
|
||||
app.getSearchUICore().refreshCustomPoiFilters();
|
||||
quickSearchDialogFragment.replaceQueryWithUiFilter(filter, "");
|
||||
quickSearchDialogFragment.reloadCategories();
|
||||
}
|
||||
|
@ -313,25 +315,16 @@ public class QuickSearchCustomPoiFragment extends DialogFragment {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void saveFilter() {
|
||||
helper.editPoiFilter(filter);
|
||||
if (!editMode) {
|
||||
Context ctx = getContext();
|
||||
if (ctx != null) {
|
||||
if (filter.isEmpty()) {
|
||||
bottomBarShadow.setVisibility(View.GONE);
|
||||
bottomBar.setVisibility(View.GONE);
|
||||
} else {
|
||||
barTitle.setText(getContext().getString(R.string.selected_categories) + ": " + filter
|
||||
.getAcceptedTypesCount());
|
||||
bottomBarShadow.setVisibility(View.VISIBLE);
|
||||
bottomBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
if (filter.isEmpty()) {
|
||||
bottomBarShadow.setVisibility(View.GONE);
|
||||
bottomBar.setVisibility(View.GONE);
|
||||
} else {
|
||||
barTitle.setText(getContext().getString(R.string.selected_categories) + ": " + filter
|
||||
.getAcceptedTypesCount());
|
||||
barTitle.setText(ctx.getString(R.string.selected_categories) + ": " + filter.getAcceptedTypesCount());
|
||||
bottomBarShadow.setVisibility(View.VISIBLE);
|
||||
bottomBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
|
|
@ -721,7 +721,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
|||
@Override
|
||||
public void onSettingsExportFinished(@NonNull File file, boolean succeed) {
|
||||
ProgressDialog progress = progressRef.get();
|
||||
if (progress != null) {
|
||||
if (progress != null && progress.isShowing()) {
|
||||
progress.dismiss();
|
||||
}
|
||||
if (succeed) {
|
||||
|
|
Loading…
Reference in a new issue