mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-31 20:25:38 +00:00
Fail safes
This commit is contained in:
parent
9c340318e8
commit
9f8c453cc6
1 changed files with 6 additions and 0 deletions
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue