From bbce6f8b1c15cb913d4890fe2764a440d741f807 Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Wed, 16 Oct 2013 13:46:11 -0700 Subject: Fix for tabCount somehow being == 0 in a pager restore method --- src/github/daneren2005/dsub/activity/SubsonicActivity.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java index 98698d87..83f11ecd 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -754,11 +754,14 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte frags.add(i, fragStack); } - currentPosition = savedInstanceState.getInt(Constants.MAIN_BACK_STACK_POSITION); - List fragStack = frags.get(currentPosition); - currentFragment = fragStack.get(fragStack.size() - 1); - currentFragment.setPrimaryFragment(true); - activity.supportInvalidateOptionsMenu(); + + if(tabCount > 0) { + currentPosition = savedInstanceState.getInt(Constants.MAIN_BACK_STACK_POSITION); + List fragStack = frags.get(currentPosition); + currentFragment = fragStack.get(fragStack.size() - 1); + currentFragment.setPrimaryFragment(true); + activity.supportInvalidateOptionsMenu(); + } } private class TabInfo { -- cgit v1.2.3