[Media Device] Add null check to avoid npe for compareTo method

Bug: 217583408
Test: N/A
Change-Id: Id3873bc79eb8200379cf63b7945fb37c4d963517
This commit is contained in:
shaoweishen
2022-04-25 08:23:52 +00:00
committed by Shaowei Shen
parent b80800cc9e
commit 4631d24e79

View File

@@ -323,6 +323,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()) {