Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Fix crash when string isEmpty (#2189)
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo authored and bluemarvin committed Nov 7, 2019
1 parent b92bf90 commit 71a671a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ private int getLanguageIndex(@NonNull String text) {
private SpannableStringBuilder getSpannedLanguageText(@NonNull String language) {
int end = getLanguageIndex(language);
SpannableStringBuilder spanned = new SpannableStringBuilder(language);
spanned.setSpan(new StyleSpan(Typeface.BOLD), 0, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
if (end > 0) {
spanned.setSpan(new StyleSpan(Typeface.BOLD), 0, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return spanned;
}

Expand Down

0 comments on commit 71a671a

Please sign in to comment.