From f995ef76eddb30e5c12a902453c229688d0b78a5 Mon Sep 17 00:00:00 2001 From: Nalla Kartheek Date: Mon, 25 Jan 2016 14:15:59 +0530 Subject: Wifi : Add null check before accessing ScanDetailCache getScanDetailCacheIfExist function shall return null if the configuration is obsent in mScanDetailCaches. Due to synchronization issue in writeKnownNetworkHistory function, it is required to add null check in all the places. Change-Id: Id6b7ee9601e4fe9a4d99f87222e4026d11903e2b CRs-Fixed: 966542 --- service/java/com/android/server/wifi/WifiConfigStore.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/service/java/com/android/server/wifi/WifiConfigStore.java b/service/java/com/android/server/wifi/WifiConfigStore.java index ec635f289..b8701b776 100644 --- a/service/java/com/android/server/wifi/WifiConfigStore.java +++ b/service/java/com/android/server/wifi/WifiConfigStore.java @@ -2342,8 +2342,9 @@ public class WifiConfigStore extends IpConfigStore { out.writeUTF(DEFAULT_GW_KEY + SEPARATOR + macAddress + NL); } - if (getScanDetailCacheIfExist(config) != null) { - for (ScanDetail scanDetail : getScanDetailCacheIfExist(config).values()) { + ScanDetailCache cache = getScanDetailCacheIfExist(config); + if (cache != null) { + for (ScanDetail scanDetail : cache.values()) { ScanResult result = scanDetail.getScanResult(); out.writeUTF(BSSID_KEY + SEPARATOR + result.BSSID + NL); -- cgit v1.2.3