summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Marado <mmarado@cyngn.com>2015-07-24 17:19:06 +0100
committerEd Mancebo <emancebo@cyngn.com>2015-08-18 09:07:27 -0700
commitcc3f63648c0a136bb7af0b6a67dbd895cbfd5a4d (patch)
tree92edfd7124b44c830cab1877ce3cccfca81dc86e
parent5ccc5a80c2724e985daae302ad81c302294d4227 (diff)
downloadpackages_apps_ContactsCommon-cc3f63648c0a136bb7af0b6a67dbd895cbfd5a4d.tar.gz
packages_apps_ContactsCommon-cc3f63648c0a136bb7af0b6a67dbd895cbfd5a4d.tar.bz2
packages_apps_ContactsCommon-cc3f63648c0a136bb7af0b6a67dbd895cbfd5a4d.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). issue-id: CYNGNOS-765 Change-Id: Ibb1dad62d33584956fbb024ced03448df8598b39 (cherry picked from commit 91100e8ba5ca6b4edbc350d614ba8558de5b064d) Change-Id: Ie62882a00d7019a0ed1363f26419add7088f237f
-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.