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

Commit 258a071d authored by Takashi Furukawa's avatar Takashi Furukawa Committed by Ningyuan Wang
Browse files

Cherry-pick: Add null check for Wi-Fi command

When WifiService is not ready during boot phase and Wi-Fi command
is executed on console, NullPointerException happens.
To prevent this, null check is needed.

Test: Manual test
Bug: 64040515
Change-Id: I5684cdc7661b7d93fd6f2ac61863919077d12935
Merged-In: I5684cdc7661b7d93fd6f2ac61863919077d12935
parent 35a563ef
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -51,6 +51,10 @@ public class WifiCommand extends Svc.Command {
            if (validCommand) {
                IWifiManager wifiMgr
                        = IWifiManager.Stub.asInterface(ServiceManager.getService(Context.WIFI_SERVICE));
                if (wifiMgr == null) {
                    System.err.println("Wi-Fi service is not ready");
                    return;
                }
                try {
                    wifiMgr.setWifiEnabled("com.android.shell", flag);
                }