From de77e7bf9227490249c40f27f4aceec7c44f2919 Mon Sep 17 00:00:00 2001 From: Weng Su Date: Wed, 11 Oct 2023 20:21:04 +0800 Subject: [PATCH] Fix NullPointerException in WifiConfigController - Add null checking for spinners to avoid NullPointerException in Monkey tests. Fix: 302628103 Test: unit test atest -c WifiConfigControllerTest Change-Id: I301163b85b0b87edba9eee2c1b34d5a6104eaaea --- src/com/android/settings/wifi/WifiConfigController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java index b2b73464c76..d2beec8dedb 100644 --- a/src/com/android/settings/wifi/WifiConfigController.java +++ b/src/com/android/settings/wifi/WifiConfigController.java @@ -653,6 +653,9 @@ public class WifiConfigController implements TextWatcher, case AccessPoint.SECURITY_EAP: case AccessPoint.SECURITY_EAP_WPA3_ENTERPRISE: case AccessPoint.SECURITY_EAP_SUITE_B: + if (mEapMethodSpinner == null || mPhase2Spinner == null) { + break; + } if (mAccessPointSecurity == AccessPoint.SECURITY_EAP_SUITE_B) { // allowedSuiteBCiphers will be set according to certificate type config.setSecurityParams(WifiConfiguration.SECURITY_TYPE_EAP_SUITE_B);