diff options
author | Tyler Gunn <tgunn@google.com> | 2015-01-08 10:28:45 -0800 |
---|---|---|
committer | Tyler Gunn <tgunn@google.com> | 2015-01-08 10:28:45 -0800 |
commit | f7fda6fe636d18a42cf5faac9166a1096e910fd0 (patch) | |
tree | 066a100e83a42fc91bcec52fd704e2ab58486efc /InCallUI | |
parent | 6a918d7c3e1ac02fbdb200fbc6c9e802a438f4a7 (diff) |
Fixing Null Pointer exception due to uninitialized view reference.
Bug indicates a crash occurred when trying to separate a call from a
conference call. The exception thrown was due to calling "setText" on
mSecondaryCallProviderLabel when it was null.
Although I was not able to reproduce this situation, it appears it would
be possible for showAndInitializeSecondaryCallInfo to not set the
mSecondaryCallProviderLabel reference when then mSecondaryCallName is
initially set if the hasProvider flag is false at the time. If
hasProvider becomes true in the future since mSecondaryCallName is already
initialized, the code to initialize mSecondaryCallProviderLabel would not
run, causing the NPE.
I have restructured the code to ensure that this type of scenario is
handled appropriately.
Bug: 18917883
Change-Id: I837d96aad7ed98729490d95beb897b08e1b08365
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardFragment.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index 4bc985578..ded88e4a8 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -727,11 +727,12 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mSecondaryCallName = (TextView) getView().findViewById(R.id.secondaryCallName); mSecondaryCallConferenceCallIcon = getView().findViewById(R.id.secondaryCallConferenceCallIcon); - if (hasProvider) { - mSecondaryCallProviderInfo.setVisibility(View.VISIBLE); - mSecondaryCallProviderLabel = (TextView) getView() - .findViewById(R.id.secondaryCallProviderLabel); - } + } + + if (mSecondaryCallProviderLabel == null && hasProvider) { + mSecondaryCallProviderInfo.setVisibility(View.VISIBLE); + mSecondaryCallProviderLabel = (TextView) getView() + .findViewById(R.id.secondaryCallProviderLabel); } } |