summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2016-05-18 00:02:11 +0200
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-05-18 09:09:59 -0700
commit21115ac80f6d2c47b9f169904536830dfc8568b2 (patch)
tree0bcad5d3c5757298b2c325d5834ab2af58639ce4
parent056b556970979d139bc6c379613cab32c8c44e66 (diff)
downloadandroid_packages_apps_Trebuchet-21115ac80f6d2c47b9f169904536830dfc8568b2.tar.gz
android_packages_apps_Trebuchet-21115ac80f6d2c47b9f169904536830dfc8568b2.tar.bz2
android_packages_apps_Trebuchet-21115ac80f6d2c47b9f169904536830dfc8568b2.zip
Trebuchet: Fix possible OOB
In some cases mText is empty and Substring will then throw an OOB Add logic to fix this (Reference: BugReports 13-20160506-12, Line #157) Change-Id: I2b32b0a56a93977d34b780afb9b3047e9fa566b0
-rw-r--r--src/com/android/launcher3/AutoExpandTextView.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/com/android/launcher3/AutoExpandTextView.java b/src/com/android/launcher3/AutoExpandTextView.java
index ea7ac896e..4dd419975 100644
--- a/src/com/android/launcher3/AutoExpandTextView.java
+++ b/src/com/android/launcher3/AutoExpandTextView.java
@@ -197,11 +197,14 @@ public class AutoExpandTextView extends TextView {
SpannableStringBuilder builder = new SpannableStringBuilder();
for (HighlightedText highlightText : sections) {
- SpannableString spannable = new SpannableString(highlightText.mText.substring(0, 1));
- spannable.setSpan(
- new ForegroundColorSpan(highlightText.mHighlight ? highlightColor : grayColor),
- 0, spannable.length(), 0);
- builder.append(spannable);
+ if (!TextUtils.isEmpty(highlightText.mText)) {
+ SpannableString spannable =
+ new SpannableString(highlightText.mText.substring(0, 1));
+ spannable.setSpan(
+ new ForegroundColorSpan(highlightText.mHighlight ? highlightColor :
+ grayColor), 0, spannable.length(), 0);
+ builder.append(spannable);
+ }
}
setText(builder);