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

Commit a731f412 authored by rambowang's avatar rambowang
Browse files

Fix phone process crash due to NPE in DataNetwork

This CL calls StateMachine#sendMessage instead of Message#sendToTarget
to avoid the NPE when the handler of the message is null.

The StateMachine handler could be null when e.g. it has quit. In
this case, calling Message#sendToTarget will cause NPE and crash
the phone process. StateMachine#sendMessage has protected against
the case to avoid the NPE when handler is null.

Bug: 270902239
Test: atest DataNetworkTest
Change-Id: Ida123e2b493cb70b005b2ac47843d7c6d6f14656
parent be228b31
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1061,7 +1061,7 @@ public class DataNetwork extends StateMachine {
                                message,
                                privilegedUids.stream().mapToInt(i -> i).toArray(),
                                null /* ex */);
                        message.sendToTarget();
                        sendMessage(message);
                    };
            TelephonyManager tm = mPhone.getContext().getSystemService(TelephonyManager.class);
            if (tm != null) {