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

Commit 7108493e authored by Henry Fang's avatar Henry Fang
Browse files

Handling none listener case

Fix the issue: NULL pointer(mEventHandler) is accessed if the listener isn't set.

bug: 171025570
Test: Manual
Change-Id: Ie136f6358f3917a62cb0a7f01870ddb590e90b0c
parent 8cc563eb
Loading
Loading
Loading
Loading
+17 −11
Original line number Diff line number Diff line
@@ -362,13 +362,16 @@ public final class MediaCas implements AutoCloseable {
        @Override
        public void onEvent(int event, int arg, @Nullable ArrayList<Byte> data)
                throws RemoteException {
            if (mEventHandler != null) {
                mEventHandler.sendMessage(mEventHandler.obtainMessage(
                    EventHandler.MSG_CAS_EVENT, event, arg, data));
            }
        }
        @Override
        public void onSessionEvent(@NonNull ArrayList<Byte> sessionId,
                int event, int arg, @Nullable ArrayList<Byte> data)
                throws RemoteException {
            if (mEventHandler != null) {
                Message msg = mEventHandler.obtainMessage();
                msg.what = EventHandler.MSG_CAS_SESSION_EVENT;
                msg.arg1 = event;
@@ -379,12 +382,15 @@ public final class MediaCas implements AutoCloseable {
                msg.setData(bundle);
                mEventHandler.sendMessage(msg);
            }
        }
        @Override
        public void onStatusUpdate(byte status, int arg)
                throws RemoteException {
            if (mEventHandler != null) {
                mEventHandler.sendMessage(mEventHandler.obtainMessage(
                    EventHandler.MSG_CAS_STATUS_EVENT, status, arg));
            }
        }
    };

    private final TunerResourceManager.ResourcesReclaimListener mResourceListener =