Prevent crash

This commit is contained in:
M66B 2020-11-24 07:30:30 +01:00
parent eb7a02b0bd
commit 2d1226daad
1 changed files with 25 additions and 0 deletions

View File

@ -217,6 +217,31 @@ public class FixedTextView extends AppCompatTextView {
} }
} }
@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
try {
super.onWindowFocusChanged(hasWindowFocus);
} catch (Throwable ex) {
Log.w(ex);
/*
java.lang.IndexOutOfBoundsException: setSpan (-1 ... -1) starts before 0
at android.text.SpannableStringInternal.checkRange(SpannableStringInternal.java:434)
at android.text.SpannableStringInternal.setSpan(SpannableStringInternal.java:155)
at android.text.SpannableString.setSpan(SpannableString.java:46)
at android.text.Selection.setSelection(Selection.java:76)
at android.widget.Editor$SelectionModifierCursorController.resetDragAcceleratorState(Editor.java:5613)
at android.widget.Editor$SelectionModifierCursorController.resetTouchOffsets(Editor.java:5603)
at android.widget.Editor$SelectionModifierCursorController.<init>(Editor.java:5286)
at android.widget.Editor.getSelectionController(Editor.java:2253)
at android.widget.Editor.refreshTextActionMode(Editor.java:1922)
at android.widget.Editor.onWindowFocusChanged(Editor.java:1314)
at android.widget.TextView.onWindowFocusChanged(TextView.java:8735)
at android.view.View.dispatchWindowFocusChanged(View.java:10246)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1196)
*/
}
}
@Override @Override
public boolean performLongClick() { public boolean performLongClick() {
try { try {