From 936296251a8cf7d65639c6cfe49d8b1c351ed18f Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Wed, 18 Jul 2018 13:50:08 +0300 Subject: [PATCH] Fix #5613 --- OsmAnd/src/net/osmand/plus/OsmandPlugin.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java index 77769f8263..73ff6755fe 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java @@ -11,6 +11,7 @@ import android.support.annotation.DrawableRes; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentManager; import android.view.View; import net.osmand.IProgress; @@ -211,12 +212,14 @@ public abstract class OsmandPlugin { final MapActivity mapActivity = (MapActivity) activity; plugin.updateLayers(mapActivity.getMapView(), mapActivity); mapActivity.getDashboard().refreshDashboardFragments(); - if (!enable && plugin.getCardFragment() != null) { - Fragment fragment = mapActivity.getSupportFragmentManager() - .findFragmentByTag(plugin.getCardFragment().tag); - LOG.debug("fragment=" + fragment); - mapActivity.getSupportFragmentManager().beginTransaction() - .remove(fragment).commit(); + + DashFragmentData fragmentData = plugin.getCardFragment(); + if (!enable && fragmentData != null) { + FragmentManager fm = mapActivity.getSupportFragmentManager(); + Fragment fragment = fm.findFragmentByTag(fragmentData.tag); + if (fragment != null) { + fm.beginTransaction().remove(fragment).commit(); + } } } return true;