am 10cd9776: am 9c4390de: am 7bc982d5: am 1b7d532f: Fix IndexArrayOutOfBounds in Utils.insertStringWithStyle
* commit '10cd97767a6341510441b2b113816c4a48ca28ce':
Fix IndexArrayOutOfBounds in Utils.insertStringWithStyle
diff --git a/src/com/android/mail/utils/Utils.java b/src/com/android/mail/utils/Utils.java
index 4d9b63f..47d9aac 100644
--- a/src/com/android/mail/utils/Utils.java
+++ b/src/com/android/mail/utils/Utils.java
@@ -1072,11 +1072,13 @@
String entireString, String subString, int appearance) {
final int index = entireString.indexOf(subString);
final SpannableString descriptionText = new SpannableString(entireString);
- descriptionText.setSpan(
- new TextAppearanceSpan(context, appearance),
- index,
- index + subString.length(),
- 0);
+ if (index >= 0) {
+ descriptionText.setSpan(
+ new TextAppearanceSpan(context, appearance),
+ index,
+ index + subString.length(),
+ 0);
+ }
return descriptionText;
}