Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0df2605 authored by qing's avatar qing
Browse files

Prevent null pointer exception in getCurrentCall method

HeadsetClientService#getCurrentCalls() return nullable, so needs to prevent null pointer in its consumer methods.


Test: N/A
Change-Id: I163dc68cb3609900bc5c6907c1643447b0a9bba9
parent 53e94fa3
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -608,10 +608,12 @@ public class HeadsetClientService extends ProfileService {
                List<BluetoothHeadsetClientCall> defaultValue = new ArrayList<>();
                List<BluetoothHeadsetClientCall> defaultValue = new ArrayList<>();
                if (service != null) {
                if (service != null) {
                    List<HfpClientCall> calls = service.getCurrentCalls(device);
                    List<HfpClientCall> calls = service.getCurrentCalls(device);
                    if (calls != null) {
                        for (HfpClientCall call : calls) {
                        for (HfpClientCall call : calls) {
                            defaultValue.add(toLegacyCall(call));
                            defaultValue.add(toLegacyCall(call));
                        }
                        }
                    }
                    }
                }
                receiver.send(defaultValue);
                receiver.send(defaultValue);
            } catch (RuntimeException e) {
            } catch (RuntimeException e) {
                receiver.propagateException(e);
                receiver.propagateException(e);