Prevent crash

This commit is contained in:
M66B 2021-06-30 20:35:00 +02:00
parent e6e7236059
commit 539874aded
1 changed files with 3 additions and 1 deletions

View File

@ -506,7 +506,9 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
if (host != null) { if (host != null) {
int textColorLink = Helper.resolveColor(context, android.R.attr.textColorLink); int textColorLink = Helper.resolveColor(context, android.R.attr.textColorLink);
int index = text.indexOf(host); int index = text.indexOf(host);
ssb.setSpan(new ForegroundColorSpan(textColorLink), index, index + host.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); if (index >= 0)
ssb.setSpan(new ForegroundColorSpan(textColorLink),
index, index + host.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
} }
return ssb; return ssb;
} }