summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Marado <mmarado@cyngn.com>2015-07-24 17:19:06 +0100
committerGerrit Code Review <gerrit@cyanogenmod.org>2015-07-28 06:15:33 -0700
commit91100e8ba5ca6b4edbc350d614ba8558de5b064d (patch)
tree2f940d1aa5920035d94929476f02ba10387951f7
parent9e828a0093f4fc4589c98428263d05234ac2a303 (diff)
downloadandroid_packages_apps_ContactsCommon-91100e8ba5ca6b4edbc350d614ba8558de5b064d.tar.gz
android_packages_apps_ContactsCommon-91100e8ba5ca6b4edbc350d614ba8558de5b064d.tar.bz2
android_packages_apps_ContactsCommon-91100e8ba5ca6b4edbc350d614ba8558de5b064d.zip
string validation: check if the string is empty
By replacing a null check with an isEmpty check, we guarantee that the string not only isn't null, but also that it isn't empty. Previously, an empty string could reach here, pass through the validation, and then provoke a StringIndexOutOfBoundsException as we try to access charAt(0). Change-Id: Ibb1dad62d33584956fbb024ced03448df8598b39 Ticket: BUGDUMP-2892952
-rw-r--r--src/com/android/contacts/common/lettertiles/LetterTileDrawable.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/com/android/contacts/common/lettertiles/LetterTileDrawable.java b/src/com/android/contacts/common/lettertiles/LetterTileDrawable.java
index 34d3d457..8b638a2f 100644
--- a/src/com/android/contacts/common/lettertiles/LetterTileDrawable.java
+++ b/src/com/android/contacts/common/lettertiles/LetterTileDrawable.java
@@ -164,7 +164,7 @@ public class LetterTileDrawable extends Drawable {
}
// Draw letter/digit only if the first character is an english letter
- if (mDisplayName != null
+ if (!TextUtils.isEmpty(mDisplayName)
&& isEnglishLetter(mDisplayName.charAt(0))
&& (mAccount == null || (!mAccount.type.equals(SimAccountType.ACCOUNT_TYPE)))) {
// Draw letter or digit.