Fix download NPE

This commit is contained in:
Victor Shcherb 2013-05-23 23:55:02 +02:00
parent b07a806159
commit c274747075

View file

@ -154,12 +154,14 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
filterText.setText(filter);
}
}
List<IndexItem> list = new ArrayList<IndexItem>();
if (downloadListIndexThread.getCachedIndexFiles() != null && downloadListIndexThread.isDownloadedFromInternet()) {
DownloadIndexAdapter adapter = new DownloadIndexAdapter(this, getFilteredByType());
setListAdapter(adapter);
list = getFilteredByType();
} else {
downloadIndexList();
}
DownloadIndexAdapter adapter = new DownloadIndexAdapter(this, list);
setListAdapter(adapter);
if(getMyApplication().getResourceManager().getIndexFileNames().isEmpty()) {
boolean showedDialog = SuggestExternalDirectoryDialog.showDialog(this, null, null);
if(!showedDialog) {
@ -219,9 +221,6 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
}
((DownloadIndexAdapter) getExpandableListAdapter()).notifyDataSetInvalidated();
}
if(getExpandableListAdapter() != null) {
((DownloadIndexAdapter)getExpandableListAdapter()).updateLoadedFiles();
}
}
private void downloadIndexList() {