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

Commit d54d112e authored by Chaohui Wang's avatar Chaohui Wang
Browse files

Fix WifiCallingPreferenceController crash

When sub id is invalid.

Bug: 325956182
Flag: EXEMPT bug fix
Test: adb shell am start -a android.settings.NETWORK_OPERATOR_SETTINGS
Change-Id: I09995095e2f38030eca0c9b5898d910530ee6237
parent c72c540a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -81,6 +81,12 @@ open class WifiCallingPreferenceController @JvmOverloads constructor(
    }

    override fun onViewCreated(viewLifecycleOwner: LifecycleOwner) {
        if (!SubscriptionManager.isValidSubscriptionId(subId)) {
            // Sub id could invalid, if this page is opened from external action and no sim is
            // active.
            // Ignore this case, since this page will be finished soon.
            return
        }
        wifiCallingRepositoryFactory(subId).wifiCallingReadyFlow()
            .collectLatestWithLifecycle(viewLifecycleOwner) { isReady ->
                preference.isVisible = isReady