Merge "[Media Device] Add null check to avoid npe for compareTo method" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-04-29 17:17:30 +00:00
committed by Android (Google) Code Review

View File

@@ -332,6 +332,9 @@ public abstract class MediaDevice implements Comparable<MediaDevice> {
*/
@Override
public int compareTo(MediaDevice another) {
if (another == null) {
return -1;
}
// Check Bluetooth device is have same connection state
if (isConnected() ^ another.isConnected()) {
if (isConnected()) {