summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuang Luong <qal@google.com>2020-08-10 09:13:14 -0700
committerQuang Luong <qal@google.com>2020-08-11 15:25:55 +0000
commita9d5ac2ceaa275e23b1673dd2f9845fd319dd0a7 (patch)
tree9c8a6b43e954f76d5bde9a4a8508445e0e1d9905
parent322b5bc56c4d59b0129842c8af55a32f0d5c43e0 (diff)
[WifiTrackerLib] Add null check to setOsuWifiEntry()
PasspointWifiEntry.setOsuWifiEntry() needs a null check for the passed in OsuWifiEntry. This flow happens if the user is on the network details page for a passpoint network and a corresponding OSU AP is also in range. If the user exits the range of the OSU AP or scan results fail to come in, then setOsuWifiEntry(null) will be called and cause an NPE. Bug: 163328661 Test: atest WifiTrackerLibTests Change-Id: I01790893a067489b671997a4fb4069ca4d3be8d3
-rw-r--r--libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java
index d873c25e5..cbc5bd4ac 100644
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/PasspointWifiEntry.java
@@ -614,7 +614,9 @@ public class PasspointWifiEntry extends WifiEntry implements WifiEntry.WifiEntry
/** Pass a reference to a matching OsuWifiEntry for expiration handling */
void setOsuWifiEntry(OsuWifiEntry osuWifiEntry) {
mOsuWifiEntry = osuWifiEntry;
- mOsuWifiEntry.setListener(this);
+ if (mOsuWifiEntry != null) {
+ mOsuWifiEntry.setListener(this);
+ }
}
/** Callback for updates to the linked OsuWifiEntry */