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

Commit ffe2dda1 authored by Paul Jensen's avatar Paul Jensen Committed by Android (Google) Code Review
Browse files

Merge "Avoid NPE when sendMessage is called after disconnect." into mnc-dev

parents fa216411 d0d42058
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -462,10 +462,8 @@ public class AsyncChannel {
        } catch(Exception e) {
        }
        // Tell source we're disconnected.
        if (mSrcHandler != null) {
        replyDisconnected(STATUS_SUCCESSFUL);
        mSrcHandler = null;
        }
        // Unlink only when bindService isn't used
        if (mConnection == null && mDstMessenger != null && mDeathMonitor!= null) {
            mDstMessenger.getBinder().unlinkToDeath(mDeathMonitor, 0);
@@ -871,6 +869,8 @@ public class AsyncChannel {
     * @param status to be stored in msg.arg1
     */
    private void replyDisconnected(int status) {
        // Can't reply if already disconnected. Avoid NullPointerException.
        if (mSrcHandler == null) return;
        Message msg = mSrcHandler.obtainMessage(CMD_CHANNEL_DISCONNECTED);
        msg.arg1 = status;
        msg.obj = this;