Hopefully fixed a rare crash in the task list fragment

pull/14/head
Sam Bosley 12 years ago
parent 3ec37a8a35
commit 45556e5a7f

@ -854,7 +854,6 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
return;
}
int oldListItemSelected = getListView().getSelectedItemPosition();
Cursor taskCursor = taskAdapter.getCursor();
if (requery) {
@ -863,9 +862,12 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
taskAdapter.notifyDataSetChanged();
}
if (getView() != null) { // This was happening sometimes
int oldListItemSelected = getListView().getSelectedItemPosition();
if (oldListItemSelected != ListView.INVALID_POSITION
&& oldListItemSelected < taskCursor.getCount())
getListView().setSelection(oldListItemSelected);
}
// also load sync actions
syncActionHelper.request();

Loading…
Cancel
Save