diff options
author | Paul Jensen <pauljensen@google.com> | 2015-05-07 15:30:46 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-07 15:30:47 +0000 |
commit | ffe2dda135880c25ed7882de7bf74ea7ce0d5564 (patch) | |
tree | d9f83faee14a5671996ffec8d40cd5f065b6160d /core | |
parent | fa21641122170777818ff838c1c19505313e83c3 (diff) | |
parent | d0d420587a462024cdf47eee1d22cf6d52a4a6a0 (diff) | |
download | frameworks_base-ffe2dda135880c25ed7882de7bf74ea7ce0d5564.zip frameworks_base-ffe2dda135880c25ed7882de7bf74ea7ce0d5564.tar.gz frameworks_base-ffe2dda135880c25ed7882de7bf74ea7ce0d5564.tar.bz2 |
Merge "Avoid NPE when sendMessage is called after disconnect." into mnc-dev
Diffstat (limited to 'core')
-rw-r--r-- | core/java/com/android/internal/util/AsyncChannel.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/java/com/android/internal/util/AsyncChannel.java b/core/java/com/android/internal/util/AsyncChannel.java index 34f62ba..bd0e6ce 100644 --- a/core/java/com/android/internal/util/AsyncChannel.java +++ b/core/java/com/android/internal/util/AsyncChannel.java @@ -462,10 +462,8 @@ public class AsyncChannel { } catch(Exception e) { } // Tell source we're disconnected. - if (mSrcHandler != null) { - replyDisconnected(STATUS_SUCCESSFUL); - 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; |