summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2015-01-08 10:28:45 -0800
committerTyler Gunn <tgunn@google.com>2015-01-08 10:28:45 -0800
commitfec0d0b784d3b93ae91577d00ba411d26916875a (patch)
treee05ed0195ce281c7fcbc9d2d2df7ceef67d1ebf1
parent179f49b03bd5f95de448996b2aef1d97dcd17287 (diff)
downloadpackages_apps_InCallUI-fec0d0b784d3b93ae91577d00ba411d26916875a.tar.gz
packages_apps_InCallUI-fec0d0b784d3b93ae91577d00ba411d26916875a.tar.bz2
packages_apps_InCallUI-fec0d0b784d3b93ae91577d00ba411d26916875a.zip
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
-rw-r--r--src/com/android/incallui/CallCardFragment.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/com/android/incallui/CallCardFragment.java b/src/com/android/incallui/CallCardFragment.java
index 4bc98557..ded88e4a 100644
--- a/src/com/android/incallui/CallCardFragment.java
+++ b/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);
}
}