From 0ff5ccc5ddc042b65a35b882f3cfc4ca0d1a4b5d Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 19 Jul 2020 10:56:49 +0200 Subject: [PATCH] Workaround yet another Android crash --- .../java/eu/faircode/email/FixedEditText.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FixedEditText.java b/app/src/main/java/eu/faircode/email/FixedEditText.java index 76f3370cbc..6ca850c68e 100644 --- a/app/src/main/java/eu/faircode/email/FixedEditText.java +++ b/app/src/main/java/eu/faircode/email/FixedEditText.java @@ -20,6 +20,7 @@ package eu.faircode.email; */ import android.content.Context; +import android.graphics.Canvas; import android.util.AttributeSet; import android.view.MotionEvent; @@ -69,6 +70,23 @@ public class FixedEditText extends AppCompatEditText { } } + @Override + protected void onDraw(Canvas canvas) { + try { + super.onDraw(canvas); + } catch (Throwable ex) { + Log.w(ex); + /* + java.lang.ArrayIndexOutOfBoundsException: length=39; index=-3 + at android.text.DynamicLayout.getBlockIndex(DynamicLayout.java:648) + at android.widget.Editor.drawHardwareAccelerated(Editor.java:1703) + at android.widget.Editor.onDraw(Editor.java:1672) + at android.widget.TextView.onDraw(TextView.java:6914) + at android.view.View.draw(View.java:19200) + */ + } + } + @Override public boolean onTouchEvent(MotionEvent event) { try {