Merge "audio: Fix possible NullPointerException when DEBUG is true"

This commit is contained in:
Treehugger Robot
2022-01-21 14:58:19 +00:00
committed by Gerrit Code Review

View File

@@ -344,10 +344,19 @@ class BluetoothRouteProvider {
} }
private void addActiveRoute(BluetoothRouteInfo btRoute) { private void addActiveRoute(BluetoothRouteInfo btRoute) {
if (btRoute == null) {
if (DEBUG) {
Log.d(TAG, " btRoute is null");
}
return;
}
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "Adding active route: " + btRoute.route); Log.d(TAG, "Adding active route: " + btRoute.route);
} }
if (btRoute == null || mActiveRoutes.contains(btRoute)) { if (mActiveRoutes.contains(btRoute)) {
if (DEBUG) {
Log.d(TAG, " btRoute is already added.");
}
return; return;
} }
setRouteConnectionState(btRoute, STATE_CONNECTED); setRouteConnectionState(btRoute, STATE_CONNECTED);