Fix crash when mention

This commit is contained in:
luvletter2333 2022-01-20 16:05:47 +08:00
parent b1dce3510f
commit f64c20581d
No known key found for this signature in database
GPG Key ID: A26A8880836E1978
1 changed files with 3 additions and 0 deletions

View File

@ -135,6 +135,9 @@ public class EditTextEffects extends EditText {
Layout layout = getLayout();
if (text instanceof Spannable && layout != null) {
int line = layout.getLineForOffset(start);
// NekoX: Fix official bug: Mention crash
if (start > layout.getText().length())
return;
int x = (int) layout.getPrimaryHorizontal(start);
int y = (int) ((layout.getLineTop(line) + layout.getLineBottom(line)) / 2f);