Merge "Add null check for Wi-Fi command"
This commit is contained in:
@@ -51,6 +51,10 @@ public class WifiCommand extends Svc.Command {
|
|||||||
if (validCommand) {
|
if (validCommand) {
|
||||||
IWifiManager wifiMgr
|
IWifiManager wifiMgr
|
||||||
= IWifiManager.Stub.asInterface(ServiceManager.getService(Context.WIFI_SERVICE));
|
= IWifiManager.Stub.asInterface(ServiceManager.getService(Context.WIFI_SERVICE));
|
||||||
|
if (wifiMgr == null) {
|
||||||
|
System.err.println("Wi-Fi service is not ready");
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
wifiMgr.setWifiEnabled("com.android.shell", flag);
|
wifiMgr.setWifiEnabled("com.android.shell", flag);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user