From e4ed72d85e692f6bcb60c7d51206c8eb837c7b79 Mon Sep 17 00:00:00 2001 From: Tomasz Wiszkowski Date: Tue, 28 Feb 2017 18:16:19 -0800 Subject: Additional checks for NPE and corner cases. Applying changes requested via comments in go/aog/342636 Bug: 35854497 Change-Id: Ied0532f92b6d1f8df2e02e6039abdab841c10fa9 --- service/java/com/android/server/wifi/WifiNative.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index 0308ec6ec..f6697e61c 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -499,6 +499,10 @@ public class WifiNative { */ public boolean p2pListNetworks(WifiP2pGroupList groups) { String networks = doStringCommand("LIST_NETWORKS"); + if (networks == null) { + logDbg("Could not fetch list of available networks."); + return false; + } String[] lines = networks.split("\n"); if (lines == null) return false; boolean modified = false; @@ -517,7 +521,7 @@ public class WifiNative { try { netId = Integer.parseInt(result[0]); } catch (NumberFormatException e) { - e.printStackTrace(); + Log.e(TAG, "Could not parse network id " + result[0], e); continue; } -- cgit v1.2.3