try catch listAdapter = null

This commit is contained in:
sonora 2014-12-21 12:48:27 +01:00
parent c651dc6b32
commit 0adcce0d91

View file

@ -480,15 +480,13 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
//fixes issue when local files not shown after switching tabs //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 //TODO: But next line throws NPE in some circumstances when called from dashboard, so needs fixing, commented out for now
int test1 = listAdapter.getGroupCount(); if (listAdapter != null && listAdapter.getGroupCount() == 0 && getDownloadActivity().getLocalIndexInfos().size() > 0) {
int test2 = getDownloadActivity().getLocalIndexInfos().size(); for(LocalIndexInfo info : getDownloadActivity().getLocalIndexInfos()) {
//if (listAdapter.getGroupCount() == 0 && getDownloadActivity().getLocalIndexInfos().size() > 0) { listAdapter.addLocalIndexInfo(info);
// for(LocalIndexInfo info : getDownloadActivity().getLocalIndexInfos()) { }
// listAdapter.addLocalIndexInfo(info); listAdapter.sortData();
// } getExpandableListView().setAdapter(listAdapter);
// listAdapter.sortData(); }
// getExpandableListView().setAdapter(listAdapter);
//}
ActionBar actionBar = getDownloadActivity().getSupportActionBar(); ActionBar actionBar = getDownloadActivity().getSupportActionBar();
//hide action bar from downloadindexfragment //hide action bar from downloadindexfragment
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);