diff --git a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java index b9689971ae..9bb2ac5354 100644 --- a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java @@ -480,15 +480,13 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { //fixes issue when local files not shown after switching tabs //TODO: But next line throws NPE in some circumstances when called from dashboard, so needs fixing, commented out for now - int test1 = listAdapter.getGroupCount(); - int test2 = getDownloadActivity().getLocalIndexInfos().size(); - //if (listAdapter.getGroupCount() == 0 && getDownloadActivity().getLocalIndexInfos().size() > 0) { - // for(LocalIndexInfo info : getDownloadActivity().getLocalIndexInfos()) { - // listAdapter.addLocalIndexInfo(info); - // } - // listAdapter.sortData(); - // getExpandableListView().setAdapter(listAdapter); - //} + if (listAdapter != null && listAdapter.getGroupCount() == 0 && getDownloadActivity().getLocalIndexInfos().size() > 0) { + for(LocalIndexInfo info : getDownloadActivity().getLocalIndexInfos()) { + listAdapter.addLocalIndexInfo(info); + } + listAdapter.sortData(); + getExpandableListView().setAdapter(listAdapter); + } ActionBar actionBar = getDownloadActivity().getSupportActionBar(); //hide action bar from downloadindexfragment actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);