Merge pull request #755 from TomHennen/fix_random_crashes

Fixed some NullPointerExceptions
This commit is contained in:
Tom Hennen 2015-04-17 17:36:15 -04:00
commit 4b427423b4
2 changed files with 8 additions and 2 deletions

View File

@ -219,7 +219,10 @@ public class AllEpisodesFragment extends Fragment {
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
menu.findItem(R.id.mark_all_read_item).setVisible(unreadItems != null && !unreadItems.isEmpty());
MenuItem menuItem = menu.findItem(R.id.mark_all_read_item);
if (menuItem != null) {
menuItem.setVisible(unreadItems != null && !unreadItems.isEmpty());
}
}
}

View File

@ -146,7 +146,10 @@ public class PlaybackHistoryFragment extends ListFragment {
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
menu.findItem(R.id.clear_history_item).setVisible(playbackHistory != null && !playbackHistory.isEmpty());
MenuItem menuItem = menu.findItem(R.id.clear_history_item);
if (menuItem != null) {
menuItem.setVisible(playbackHistory != null && !playbackHistory.isEmpty());
}
}
}