From 74e1c62a145bb07f4662425dac7819d407218c31 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Fri, 10 Feb 2012 13:02:16 -0800 Subject: [PATCH] Fixed potential null pointer when constructing certain help info popovers --- .../astrid/taskrabbit/TaskRabbitActivity.java | 1 - .../astrid/activity/TaskListFragment.java | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitActivity.java b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitActivity.java index fbc79d39e..d6d0e0aa3 100644 --- a/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/taskrabbit/TaskRabbitActivity.java @@ -163,7 +163,6 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList public void showAddListPopover() { - ActionBar actionBar = getSupportActionBar(); HelpInfoPopover.showPopover(this, actionBar.getCustomView().findViewById(R.id.menu_nav), R.string.help_popover_add_lists, null); } diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java b/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java index 3565bbbb4..4528b43b3 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java @@ -931,9 +931,12 @@ public class TaskListFragment extends ListFragment implements OnScrollListener, quickAddBox.postDelayed(new Runnable() { @Override public void run() { - HelpInfoPopover.showPopover(getActivity(), quickAddBox, - R.string.help_popover_add_task, null); - Preferences.setBoolean(R.string.p_showed_add_task_help, true); + Activity activity = getActivity(); + if (activity != null) { + HelpInfoPopover.showPopover(getActivity(), quickAddBox, + R.string.help_popover_add_task, null); + Preferences.setBoolean(R.string.p_showed_add_task_help, true); + } } }, 1000); } @@ -1100,9 +1103,12 @@ public class TaskListFragment extends ListFragment implements OnScrollListener, final View view = getListView().getChildAt( getListView().getChildCount() - 1); if (view != null) { - HelpInfoPopover.showPopover(getActivity(), view, - R.string.help_popover_tap_task, null); - Preferences.setBoolean(R.string.p_showed_tap_task_help, true); + Activity activity = getActivity(); + if (activity != null) { + HelpInfoPopover.showPopover(getActivity(), view, + R.string.help_popover_tap_task, null); + Preferences.setBoolean(R.string.p_showed_tap_task_help, true); + } } } } catch (IllegalStateException e) {