Skip to content

Commit ea6a111

Browse files
committed
BtHelper: PodsService: Correctly catch NullPointerException on onStartCommand
Change-Id: Ia0fbb2018474d16cb28d8378259ace5d3b4f65aa
1 parent 9744452 commit ea6a111

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/com/android/bluetooth/bthelper/pods/PodsService.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,14 @@ public IBinder onBind (Intent intent) {
136136

137137
@Override
138138
public int onStartCommand (Intent intent, int flags, int startId) {
139-
final BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
140-
if (device != null) {
141-
mCurrentDevice = device;
142-
setLowLatencyAudio(getApplicationContext());
143-
startAirPodsScanner();
139+
try {
140+
final BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
141+
if (device != null) {
142+
mCurrentDevice = device;
143+
setLowLatencyAudio(getApplicationContext());
144+
startAirPodsScanner();
145+
}
146+
} catch (NullPointerException e) {
144147
}
145148
return START_STICKY;
146149
}

0 commit comments

Comments
 (0)