Fixed potential null pointer when constructing certain help info popovers

pull/14/head
Sam Bosley 14 years ago
parent 62c683fc85
commit 74e1c62a14

@ -163,7 +163,6 @@ public class TaskRabbitActivity extends FragmentActivity implements LocationList
public void showAddListPopover() { public void showAddListPopover() {
ActionBar actionBar = getSupportActionBar(); ActionBar actionBar = getSupportActionBar();
HelpInfoPopover.showPopover(this, actionBar.getCustomView().findViewById(R.id.menu_nav), R.string.help_popover_add_lists, null); HelpInfoPopover.showPopover(this, actionBar.getCustomView().findViewById(R.id.menu_nav), R.string.help_popover_add_lists, null);
} }

@ -931,10 +931,13 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
quickAddBox.postDelayed(new Runnable() { quickAddBox.postDelayed(new Runnable() {
@Override @Override
public void run() { public void run() {
Activity activity = getActivity();
if (activity != null) {
HelpInfoPopover.showPopover(getActivity(), quickAddBox, HelpInfoPopover.showPopover(getActivity(), quickAddBox,
R.string.help_popover_add_task, null); R.string.help_popover_add_task, null);
Preferences.setBoolean(R.string.p_showed_add_task_help, true); Preferences.setBoolean(R.string.p_showed_add_task_help, true);
} }
}
}, 1000); }, 1000);
} }
} }
@ -1100,11 +1103,14 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
final View view = getListView().getChildAt( final View view = getListView().getChildAt(
getListView().getChildCount() - 1); getListView().getChildCount() - 1);
if (view != null) { if (view != null) {
Activity activity = getActivity();
if (activity != null) {
HelpInfoPopover.showPopover(getActivity(), view, HelpInfoPopover.showPopover(getActivity(), view,
R.string.help_popover_tap_task, null); R.string.help_popover_tap_task, null);
Preferences.setBoolean(R.string.p_showed_tap_task_help, true); Preferences.setBoolean(R.string.p_showed_tap_task_help, true);
} }
} }
}
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
// Whoops, view is gone. Try again later // Whoops, view is gone. Try again later
} }

Loading…
Cancel
Save