summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2016-05-18 00:02:11 +0200
committerTom Powell <zifnab@zifnab06.net>2017-03-26 16:23:05 -0700
commit72457c8d51d061c2d25184c99def37b96f764aa0 (patch)
treeea189c8d58930116aaba7b00d3922c9066b9684d
parent712fe30e347361807b744aceb0683673481c3a77 (diff)
downloadandroid_packages_apps_Trebuchet-72457c8d51d061c2d25184c99def37b96f764aa0.zip
android_packages_apps_Trebuchet-72457c8d51d061c2d25184c99def37b96f764aa0.tar.gz
android_packages_apps_Trebuchet-72457c8d51d061c2d25184c99def37b96f764aa0.tar.bz2
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 ea7ac89..4dd4199 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);