Fix possible NPE on showDialpadChooser()
NPE happens when DialtactsActivity#onNewIntent() is called before
DialpadFragment#onCreateView() is called (which may happen if it is not
attached yet), and DialpadFragment#configureScreenFromIntent()
is called before View objects point to something meaningful.
onCreateView() calls configureScreenFromIntent(), so just ignore the too
early request.
Bug: 5157905
Change-Id: I90eb6ac788fbef4d37527ac224561fba67c058fd
diff --git a/src/com/android/contacts/dialpad/DialpadFragment.java b/src/com/android/contacts/dialpad/DialpadFragment.java
index a5db5ce..720c33a 100644
--- a/src/com/android/contacts/dialpad/DialpadFragment.java
+++ b/src/com/android/contacts/dialpad/DialpadFragment.java
@@ -910,6 +910,11 @@
* of the regular Dialer UI
*/
private void showDialpadChooser(boolean enabled) {
+ // Check if onCreateView() is already called by checking one of View objects.
+ if (mDigits == null) {
+ return;
+ }
+
if (enabled) {
// Log.i(TAG, "Showing dialpad chooser!");
mDigits.setVisibility(View.GONE);