Update EditTextEffects.java

This commit is contained in:
Laky64 2022-12-29 14:09:04 +01:00 committed by GitHub
parent 711f26cb11
commit ffccac682e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -146,8 +146,7 @@ public class EditTextEffects extends EditText {
invalidateEffects(); invalidateEffects();
Layout layout = getLayout(); Layout layout = getLayout();
if (text instanceof Spannable && layout != null) { if (text instanceof Spannable && layout != null && start <= layout.getLineCount()) {
if (start > layout.getLineCount()) return;
int line = layout.getLineForOffset(start); int line = layout.getLineForOffset(start);
int x = (int) layout.getPrimaryHorizontal(start); int x = (int) layout.getPrimaryHorizontal(start);
int y = (int) ((layout.getLineTop(line) + layout.getLineBottom(line)) / 2f); int y = (int) ((layout.getLineTop(line) + layout.getLineBottom(line)) / 2f);