Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 71af1e59 authored by Marten Gajda's avatar Marten Gajda Committed by GitHub
Browse files

Fix potential StringIndexOutOfBoundsException, fixes #1020 (#1023)

At present it's still unclear under which condition this issue was
triggered. It should no longer crash though, the UI might just behave a
bit strangely instead.
parent f5ad4ae7
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -332,9 +332,10 @@ public class DescriptionFieldView extends AbstractFieldView implements OnChecked
                    return true;
                }
                // split current
                int sel = text.getSelectionStart();
                String newText = text.getText().toString().substring(sel);
                item.text = text.getText().toString().substring(0, sel);
                String current = text.getText().toString();
                int sel = Math.max(0, Math.min(current.length(), text.getSelectionStart()));
                String newText = current.substring(sel);
                item.text = current.substring(0, sel);
                text.setText(item.text);
                text.clearFocus();
                // create new item with new test