diff options
author | Anthony Lee <anthonylee@google.com> | 2014-12-02 12:13:42 -0800 |
---|---|---|
committer | Anthony Lee <anthonylee@google.com> | 2014-12-03 10:08:19 -0800 |
commit | df47edd9c77a0117c34dd73ef6ef4468dac221e8 (patch) | |
tree | a614dd60c6e32574c550574e06adcd5a55f41d6e /src/com/android/dialer/calllog | |
parent | 5dee1ce62f9349102d426e7b8285682e22a37152 (diff) |
NPE fix.
Make sure that we check the validity of the label before we
call a method on it. Also removed import of unused package.
Bug: 18572439
Change-Id: I4b9ae0b4ace4129fe92dcbd9abecc12620d45a86
Diffstat (limited to 'src/com/android/dialer/calllog')
-rw-r--r-- | src/com/android/dialer/calllog/PhoneAccountUtils.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/com/android/dialer/calllog/PhoneAccountUtils.java b/src/com/android/dialer/calllog/PhoneAccountUtils.java index 3979a3e5e..adeec0f2b 100644 --- a/src/com/android/dialer/calllog/PhoneAccountUtils.java +++ b/src/com/android/dialer/calllog/PhoneAccountUtils.java @@ -18,7 +18,6 @@ package com.android.dialer.calllog; import android.content.ComponentName; import android.content.Context; -import android.graphics.drawable.Drawable; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; @@ -65,7 +64,10 @@ public class PhoneAccountUtils { */ public static String getAccountLabel(Context context, PhoneAccountHandle accountHandle) { PhoneAccount account = getAccountOrNull(context, accountHandle); - return account == null ? null : account.getLabel().toString(); + if (account != null && account.getLabel() != null) { + return account.getLabel().toString(); + } + return null; } /** |