Add null check for config when clicking on wifi picker entry

Null check is needed when getting wifi configuration instead of relying
on isSaved() since isSaved() may be true while getWifiConfiguration() is
null.

Bug: 153029289
Test: manual tapping on suggested entry and verifying no crash
Change-Id: Id487f48bd2079d596ea157920e4709fb8407ee9f
This commit is contained in:
Quang Luong
2020-04-01 19:57:46 -07:00
parent 947cb48303
commit 9cc099ab7e

View File

@@ -538,7 +538,7 @@ public class WifiSettings2 extends RestrictedSettingsFragment
final WifiEntry selectedEntry =
((LongPressWifiEntryPreference) preference).getWifiEntry();
if (selectedEntry.isSaved()) {
if (selectedEntry.getWifiConfiguration() != null) {
if (!selectedEntry.getWifiConfiguration().getNetworkSelectionStatus()
.hasEverConnected()) {
launchConfigNewNetworkFragment(selectedEntry);