summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Shrauner <shrauner@google.com>2015-12-03 10:14:43 -0800
committerJay Shrauner <shrauner@google.com>2015-12-08 11:50:10 -0800
commitb4bcb72539dc7982190357b5bc950c2b41d2a9db (patch)
tree55314b6a4bbfb0fe48e89fd2dfda2a80801dbcad
parentdad42273d7fc26d2be5215da42473b624271d7ad (diff)
Fix NPE in matchesNumber
Check for null phoneNumber Bug:25973238 Change-Id: I019bf4be0598896a8f4a93f5331d98f78f98b786
-rw-r--r--src/com/android/dialer/dialpad/SmartDialNameMatcher.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/com/android/dialer/dialpad/SmartDialNameMatcher.java b/src/com/android/dialer/dialpad/SmartDialNameMatcher.java
index 01268641d..a54fe1618 100644
--- a/src/com/android/dialer/dialpad/SmartDialNameMatcher.java
+++ b/src/com/android/dialer/dialpad/SmartDialNameMatcher.java
@@ -16,6 +16,7 @@
package com.android.dialer.dialpad;
+import android.support.annotation.Nullable;
import android.text.TextUtils;
import com.android.dialer.dialpad.SmartDialPrefix.PhoneNumberTokens;
@@ -123,7 +124,11 @@ public class SmartDialNameMatcher {
* SmartDialMatchPosition with the matching positions otherwise
*/
@VisibleForTesting
+ @Nullable
public SmartDialMatchPosition matchesNumber(String phoneNumber, String query, boolean useNanp) {
+ if (TextUtils.isEmpty(phoneNumber)) {
+ return null;
+ }
StringBuilder builder = new StringBuilder();
constructEmptyMask(builder, phoneNumber.length());
mPhoneNumberMatchMask = builder.toString();