1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-31 20:25:38 +00:00

Fail safes

This commit is contained in:
M66B 2021-05-18 07:38:32 +02:00
parent 9c340318e8
commit 9f8c453cc6

View file

@ -1991,6 +1991,9 @@ public class FragmentCompose extends FragmentBase {
int end = etBody.getSelectionEnd();
Editable edit = etBody.getText();
if (start < 0 || end < 0)
return;
if (start > end) {
int tmp = start;
start = end;
@ -2060,6 +2063,9 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onExecuted(Bundle args, String translated) {
if (insert > edit.length())
return;
// Insert translated text
edit.insert(insert, "\n" + translated);
etBody.setSelection(insert + 1 + translated.length());