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

Commit 3afa6e6d authored by Zhaolei's avatar Zhaolei Committed by Gerrit - the friendly Code Review server
Browse files

Settings: Fix settings force close in monkey test.

Unable to start activity ComponentInfo{../...settings.SubSettings}: java.lang.IllegalArgumentException: Cannot add a null child view to a ViewGroup.

Forece close caused by mUnmount is null. Add check to avoid.

Change-Id: I4e4e2568f488b79e2090de27ca05858467927474
CRs-Fixed: 1084021
parent 7490210d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -135,6 +135,16 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
        final ViewGroup buttonBar = getButtonBar();
        buttonBar.removeAllViews();
        buttonBar.setPadding(padding, padding, padding, padding);

        //Fixed monkey test issue
        //Settings crash caused by null pointer parameter
        //Add check with mUnmount's values
        if (null == mUnmount) {
            mUnmount = new Button(getActivity());
            mUnmount.setText(R.string.storage_menu_unmount);
            mUnmount.setOnClickListener(mUnmountListener);
        }

        buttonBar.addView(mUnmount, new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));