From 757bdd39b79c38f1f7713aa16db95d8a8f5dc6da Mon Sep 17 00:00:00 2001 From: Jay Shrauner Date: Wed, 28 May 2014 10:13:40 -0700 Subject: Fix NPE in getCallLogEntryUris Detect when the ids array (EXTRA_CALL_LOG_IDS) is not present. Bug:15308670 Change-Id: Ibd0d025f1d160942fa5a61e210f5057d7f31b54d --- src/com/android/dialer/CallDetailActivity.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/com/android/dialer') diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index decfe9bf1..098e9882e 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -398,14 +398,15 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware * If both are available, the data on the intent takes precedence. */ private Uri[] getCallLogEntryUris() { - Uri uri = getIntent().getData(); + final Uri uri = getIntent().getData(); if (uri != null) { // If there is a data on the intent, it takes precedence over the extra. return new Uri[]{ uri }; } - long[] ids = getIntent().getLongArrayExtra(EXTRA_CALL_LOG_IDS); - Uri[] uris = new Uri[ids.length]; - for (int index = 0; index < ids.length; ++index) { + final long[] ids = getIntent().getLongArrayExtra(EXTRA_CALL_LOG_IDS); + final int numIds = ids == null ? 0 : ids.length; + final Uri[] uris = new Uri[numIds]; + for (int index = 0; index < numIds; ++index) { uris[index] = ContentUris.withAppendedId(Calls.CONTENT_URI_WITH_VOICEMAIL, ids[index]); } return uris; -- cgit v1.2.3