Merge "[Bugfix]audio:fix NPE when buildBluetoothRoutes"

This commit is contained in:
Treehugger Robot
2020-12-14 01:33:36 +00:00
committed by Gerrit Code Review

View File

@@ -165,11 +165,13 @@ class BluetoothRouteProvider {
private void buildBluetoothRoutes() { private void buildBluetoothRoutes() {
mBluetoothRoutes.clear(); mBluetoothRoutes.clear();
for (BluetoothDevice device : mBluetoothAdapter.getBondedDevices()) { if (mBluetoothAdapter.getBondedDevices() != null) {
if (device.isConnected()) { for (BluetoothDevice device : mBluetoothAdapter.getBondedDevices()) {
BluetoothRouteInfo newBtRoute = createBluetoothRoute(device); if (device.isConnected()) {
if (newBtRoute.connectedProfiles.size() > 0) { BluetoothRouteInfo newBtRoute = createBluetoothRoute(device);
mBluetoothRoutes.put(device.getAddress(), newBtRoute); if (newBtRoute.connectedProfiles.size() > 0) {
mBluetoothRoutes.put(device.getAddress(), newBtRoute);
}
} }
} }
} }