From 7a1bbb1b7a329a3da733f54f23336ecd111bc74f Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 8 Sep 2017 10:21:38 +0300 Subject: [PATCH] Fix NPE in child fragments --- .../plus/mapmarkers/MapMarkersDialogFragment.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java index abd1ade119..be0150a73d 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java @@ -44,11 +44,13 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { List fragments = getChildFragmentManager().getFragments(); - for (Fragment fragment : fragments) { - if (fragment instanceof MapMarkersActiveFragment) { - activeFragment = (MapMarkersActiveFragment) fragment; - } else if (fragment instanceof MapMarkersHistoryFragment) { - historyFragment = (MapMarkersHistoryFragment) fragment; + if (fragments != null) { + for (Fragment fragment : fragments) { + if (fragment instanceof MapMarkersActiveFragment) { + activeFragment = (MapMarkersActiveFragment) fragment; + } else if (fragment instanceof MapMarkersHistoryFragment) { + historyFragment = (MapMarkersHistoryFragment) fragment; + } } } if (activeFragment == null) {