Fixed potential crash during app start.
This commit is contained in:
parent
65c5e0e793
commit
55bb705ac0
1 changed files with 7 additions and 4 deletions
|
@ -216,11 +216,14 @@ public class MainActivity extends ActionBarActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
|
// Avoid crash if called during startup.
|
||||||
|
if (mServerFragment != null && mRouteFragment != null) {
|
||||||
FragmentManager fm = getSupportFragmentManager();
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
fm.putFragment(outState, ServerFragment.class.getName(), mServerFragment);
|
fm.putFragment(outState, ServerFragment.class.getName(), mServerFragment);
|
||||||
fm.putFragment(outState, RouteFragment.class.getName(), mRouteFragment);
|
fm.putFragment(outState, RouteFragment.class.getName(), mRouteFragment);
|
||||||
outState.putInt("currentTab", mViewPager.getCurrentItem());
|
outState.putInt("currentTab", mViewPager.getCurrentItem());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forwards back press to active Fragment (unless the fragment is
|
* Forwards back press to active Fragment (unless the fragment is
|
||||||
|
|
Reference in a new issue