Prevent NPE

This commit is contained in:
Martin Fietz 2016-11-19 15:53:17 +01:00
parent f34b673ac5
commit 7f29627ac7
1 changed files with 4 additions and 2 deletions

View File

@ -100,6 +100,7 @@ public class ItemlistFragment extends ListFragment {
private boolean itemsLoaded = false; private boolean itemsLoaded = false;
private boolean viewsCreated = false; private boolean viewsCreated = false;
private boolean headerCreated = false;
private List<Downloader> downloaderList; private List<Downloader> downloaderList;
@ -466,8 +467,8 @@ public class ItemlistFragment extends ListFragment {
} }
private void refreshHeaderView() { private void refreshHeaderView() {
if (getListView() == null || feed == null) { if (getListView() == null || feed == null || !headerCreated) {
Log.e(TAG, "Unable to setup listview: recyclerView = null or feed = null"); Log.e(TAG, "Unable to refresh header view");
return; return;
} }
if(feed.hasLastUpdateFailed()) { if(feed.hasLastUpdateFailed()) {
@ -546,6 +547,7 @@ public class ItemlistFragment extends ListFragment {
startActivity(startIntent); startActivity(startIntent);
} }
}); });
headerCreated = true;
} }