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

Commit ef2b35ad authored by pkanwar's avatar pkanwar
Browse files

DO NOT MERGE: Fix NPE in ConfigureWifiSettings.

NPE was introduced as part of recent changes for Carrier Wifi networks.
This CL adds a null check.

Bug: 34050661
Change-Id: I585f6499b1ca06d9bd25ad3449f035c5a616a140
parent cd3475f3
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -101,6 +101,13 @@ public class ConfigureWifiSettings extends SettingsPreferenceFragment

        if (!mWifiManager.hasCarrierConfiguredNetworks()){
            removePreference(KEY_CONNECT_CARRIER_NETWORKS);
        } else {
            SwitchPreference connectToCarrierNetworks =
                    (SwitchPreference) findPreference(KEY_CONNECT_CARRIER_NETWORKS);
            if (connectToCarrierNetworks != null) {
                connectToCarrierNetworks.setChecked(Settings.Global.getInt(getContentResolver(),
                        Settings.Global.WIFI_CONNECT_CARRIER_NETWORKS, 0) == 1);
            }
        }

        SwitchPreference notifyOpenNetworks =
@@ -109,11 +116,6 @@ public class ConfigureWifiSettings extends SettingsPreferenceFragment
                Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0) == 1);
        notifyOpenNetworks.setEnabled(mWifiManager.isWifiEnabled());

        SwitchPreference connectToCarrierNetworks =
                (SwitchPreference) findPreference(KEY_CONNECT_CARRIER_NETWORKS);
        connectToCarrierNetworks.setChecked(Settings.Global.getInt(getContentResolver(),
                Settings.Global.WIFI_CONNECT_CARRIER_NETWORKS, 0) == 1);

        final Context context = getActivity();
        if (avoidBadWifiConfig()) {
            // Hide preference toggle, always avoid bad wifi networks.