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

Commit 8f7eadf9 authored by Eugene Susla's avatar Eugene Susla
Browse files

[Companion] Fix NPE due to looking up view btoo soon

Fixes: b/64101223
Test: Ensure attached bug no longer reproduces
Change-Id: I23bb05c5355972ce96d08f620ceb8463df3fe853
parent 12c586c5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -55,8 +55,6 @@ public class DeviceChooserActivity extends Activity {
            Log.e(LOG_TAG, "About to show UI, but no devices to show");
        }

        mPairButton = findViewById(R.id.button_pair);

        if (getService().mRequest.isSingleDevice()) {
            setContentView(R.layout.device_confirmation);
            final DeviceFilterPair selectedDevice = getService().mDevicesFound.get(0);
@@ -64,11 +62,13 @@ public class DeviceChooserActivity extends Activity {
                    R.string.confirmation_title,
                    getCallingAppName(),
                    selectedDevice.getDisplayName()), 0));
            mPairButton = findViewById(R.id.button_pair);
            mPairButton.setOnClickListener(v -> onDeviceConfirmed(getService().mSelectedDevice));
            getService().mSelectedDevice = selectedDevice;
            onSelectionUpdate();
        } else {
            setContentView(R.layout.device_chooser);
            mPairButton = findViewById(R.id.button_pair);
            mPairButton.setVisibility(View.GONE);
            setTitle(Html.fromHtml(getString(R.string.chooser_title, getCallingAppName()), 0));
            mDeviceListView = findViewById(R.id.device_list);