Added try/catch to fix crash when showing task edit popover after delay

pull/14/head
Sam Bosley 14 years ago
parent 947f0fe1b7
commit 8a023f9409

@ -1054,14 +1054,18 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
imm.hideSoftInputFromWindow(quickAddBox.getWindowToken(), 0); imm.hideSoftInputFromWindow(quickAddBox.getWindowToken(), 0);
getListView().postDelayed(new Runnable() { getListView().postDelayed(new Runnable() {
public void run() { public void run() {
if (taskAdapter != null && taskAdapter.getCount() > 0) { try {
final View view = getListView().getChildAt( if (taskAdapter != null && taskAdapter.getCount() > 0) {
getListView().getChildCount() - 1); final View view = getListView().getChildAt(
if (view != null) { getListView().getChildCount() - 1);
HelpInfoPopover.showPopover(getActivity(), view, if (view != null) {
R.string.help_popover_tap_task, null); HelpInfoPopover.showPopover(getActivity(), view,
Preferences.setBoolean(R.string.p_showed_tap_task_help, true); R.string.help_popover_tap_task, null);
Preferences.setBoolean(R.string.p_showed_tap_task_help, true);
}
} }
} catch (IllegalStateException e) {
// Whoops, view is gone. Try again later
} }
} }
}, 1000L); }, 1000L);

Loading…
Cancel
Save