Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8aec08f authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Fix potential NPE with ActionBar and SwitchBar references

- in some rare cases (SetupWizard and select WiFi during account
creation) there is no ActionBar nor SwitchBar. Prevent any NPE
coming from them.

Change-Id: If52b9cdee8730c90c5da3067a1a35ebdd0255470
parent 8b81bfff
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -505,9 +505,10 @@ public class SettingsActivity extends Activity
        }

        mActionBar = getActionBar();
        if (mActionBar != null) {
            mActionBar.setDisplayHomeAsUpEnabled(mDisplayHomeAsUpEnabled);
            mActionBar.setHomeButtonEnabled(mDisplayHomeAsUpEnabled);

        }
        mSwitchBar = (SwitchBar) findViewById(R.id.switch_bar);

        // see if we should show Back/Next buttons
@@ -1250,7 +1251,8 @@ public class SettingsActivity extends Activity
        if (current != null && current instanceof SearchResultsSummary) {
            mSearchResultsFragment = (SearchResultsSummary) current;
        } else {
            final boolean isShowingSwitchBar = mSwitchBar.isShowing();
            final boolean isShowingSwitchBar =
                    (mSwitchBar != null) ? mSwitchBar.isShowing() : false;
            String title = getString(R.string.search_results_title);
            mSearchResultsFragment = (SearchResultsSummary) switchToFragment(
                    SearchResultsSummary.class.getName(), null, false, true, title,