From cc3f63648c0a136bb7af0b6a67dbd895cbfd5a4d Mon Sep 17 00:00:00 2001 From: Marcos Marado Date: Fri, 24 Jul 2015 17:19:06 +0100 Subject: 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). issue-id: CYNGNOS-765 Change-Id: Ibb1dad62d33584956fbb024ced03448df8598b39 (cherry picked from commit 91100e8ba5ca6b4edbc350d614ba8558de5b064d) Change-Id: Ie62882a00d7019a0ed1363f26419add7088f237f --- src/com/android/contacts/common/lettertiles/LetterTileDrawable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. -- cgit v1.2.3