diff options
author | Jay Shrauner <shrauner@google.com> | 2014-03-21 10:08:20 -0700 |
---|---|---|
committer | Jay Shrauner <shrauner@google.com> | 2014-03-21 10:53:58 -0700 |
commit | d9c22d541f04eefc748c65c252353ab1395a7537 (patch) | |
tree | e3c7869b0ff8a2be4e4498172eceac477079f79d | |
parent | b742c981b54cbd93c8355095963bd82f5a12d79d (diff) |
Fix NPE in ConferenceManagerPresenter
Fix NPE in ConferenceManagerPresenter
Bug:13582463
Change-Id: I31ec7b72142828832b6b2edaa89bb2b499da966c
-rw-r--r-- | InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java b/InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java index 1ba88cbd7..6e73a69e0 100644 --- a/InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java +++ b/InCallUI/src/com/android/incallui/ConferenceManagerPresenter.java @@ -35,7 +35,6 @@ public class ConferenceManagerPresenter private static final int MAX_CALLERS_IN_CONFERENCE = 5; - private int mNumCallersInConference; private Integer[] mCallerIds; private Context mContext; @@ -80,10 +79,15 @@ public class ConferenceManagerPresenter } private void update(CallList callList) { - mCallerIds = null; - mCallerIds = callList.getActiveOrBackgroundCall().getChildCallIds().toArray(new Integer[0]); - mNumCallersInConference = mCallerIds.length; - Log.v(this, "Number of calls is " + String.valueOf(mNumCallersInConference)); + // callList is non null, but getActiveOrBackgroundCall() may return null + final Call currentCall = callList.getActiveOrBackgroundCall(); + if (currentCall != null) { + // getChildCallIds() always returns a valid Set + mCallerIds = currentCall.getChildCallIds().toArray(new Integer[0]); + } else { + mCallerIds = new Integer[0]; + } + Log.d(this, "Number of calls is " + String.valueOf(mCallerIds.length)); // Users can split out a call from the conference call if there either the active call // or the holding call is empty. If both are filled at the moment, users can not split out @@ -93,7 +97,7 @@ public class ConferenceManagerPresenter boolean canSeparate = !(hasActiveCall && hasHoldingCall); for (int i = 0; i < MAX_CALLERS_IN_CONFERENCE; i++) { - if (i < mNumCallersInConference) { + if (i < mCallerIds.length) { // Fill in the row in the UI for this caller. final ContactCacheEntry contactCache = ContactInfoCache.getInstance(mContext). @@ -149,11 +153,15 @@ public class ConferenceManagerPresenter } public void separateConferenceConnection(int rowId) { - CallCommandClient.getInstance().separateCall(mCallerIds[rowId]); + if (rowId < mCallerIds.length) { + CallCommandClient.getInstance().separateCall(mCallerIds[rowId]); + } } public void endConferenceConnection(int rowId) { - CallCommandClient.getInstance().disconnectCall(mCallerIds[rowId]); + if (rowId < mCallerIds.length) { + CallCommandClient.getInstance().disconnectCall(mCallerIds[rowId]); + } } public interface ConferenceManagerUi extends Ui { |