Skip to content
Snippets Groups Projects
Commit 6e9bd12e authored by Vance Yu's avatar Vance Yu Committed by Jayden Kim
Browse files

Fix the BT settings is crashing after Toggle OFF/ON

Fix java NullPointerException since some object was not created
when users didn't performed BLE advertising.

Bug: 213610155
Bug: 242230899
Tag: #stability
Test: turn on/off Bluetooth in the setting then check if Bluetooth crashes happen.
Ignore-AOSP-First: patch for wear os
Change-Id: I3adccd699e10fef79579880f0110ae8474f36955
parent e6977064
No related branches found
No related tags found
No related merge requests found
......@@ -195,7 +195,8 @@ import java.util.UUID;
private static final int ADVERTISE_STATE_MAX_SIZE = 5;
private EvictingQueue<AppAdvertiseStats> mLastAdvertises;
private final EvictingQueue<AppAdvertiseStats> mLastAdvertises =
EvictingQueue.create(ADVERTISE_STATE_MAX_SIZE);
/** Internal list of connected devices **/
private Set<Connection> mConnections = new HashSet<Connection>();
......@@ -246,10 +247,6 @@ import java.util.UUID;
app = new App(appUid, callback, appName);
mApps.add(app);
}
if (mLastAdvertises == null) {
mLastAdvertises = EvictingQueue.create(ADVERTISE_STATE_MAX_SIZE);
}
return app;
}
}
......@@ -630,7 +627,9 @@ import java.util.UUID;
while (i.hasNext()) {
App entry = i.next();
entry.unlinkToDeath();
entry.appScanStats.isRegistered = false;
if (entry.appScanStats != null) {
entry.appScanStats.isRegistered = false;
}
i.remove();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment