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

Commit a15deadb authored by shubang's avatar shubang
Browse files

[TIAF] Add null checks to avoid NPEs

Bug: 278628657
Test: atest TvInputServiceTest
Change-Id: Ieae1481781b58b23a3449961fcaa0b51d02d8d0a
parent 75faf083
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -269,6 +269,10 @@ class TvInputHardwareManager implements TvInputHal.Callback {
    @Override
    public void onTvMessage(int deviceId, int type, Bundle data) {
        synchronized (mLock) {
            String inputId = mHardwareInputIdMap.get(deviceId);
            if (inputId == null) {
                return;
            }
            SomeArgs args = SomeArgs.obtain();
            args.arg1 = mHardwareInputIdMap.get(deviceId);
            args.arg2 = data;
+4 −0
Original line number Diff line number Diff line
@@ -4152,6 +4152,10 @@ public final class TvInputManagerService extends SystemService {
            synchronized (mLock) {
                UserState userState = getOrCreateUserStateLocked(mCurrentUserId);
                TvInputState inputState = userState.inputMap.get(inputId);
                if (inputState == null) {
                    Slog.e(TAG, "failed to send TV message - unknown input id " + inputId);
                    return;
                }
                ServiceState serviceState = userState.serviceStateMap.get(inputState.info
                        .getComponent());
                for (IBinder token : serviceState.sessionTokens) {