Avoid NPE since getBluetoothClass is nullable

Bug: 264224476
Test: build pass.
Change-Id: I2d55f95f0a37dc31b64f85f51184338f700d1085
This commit is contained in:
SongFerngWang
2023-01-03 16:47:04 +08:00
parent 03882bc8bd
commit 20943eb26b

View File

@@ -275,6 +275,10 @@ public class LeAudioProfile implements LocalBluetoothProfile {
}
public int getDrawableResource(BluetoothClass btClass) {
if (btClass == null) {
Log.e(TAG, "No btClass.");
return R.drawable.ic_bt_le_audio_speakers;
}
switch (btClass.getDeviceClass()) {
case BluetoothClass.Device.AUDIO_VIDEO_UNCATEGORIZED:
case BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET: