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

Commit c832bd57 authored by Clara Bayarri's avatar Clara Bayarri
Browse files

Fix crash in EditText#getText

EditText#getText assumes the text is editable. However if this is
called during construction, the text might still be a String.

Bug: 36972818
Test: bit CtsWidgetTestCases:.EditTextTest
Change-Id: I811fad057f33666692930cb60d696740f7b40a19
parent 04c17bec
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -105,6 +105,11 @@ public class EditText extends TextView {


    @Override
    @Override
    public Editable getText() {
    public Editable getText() {
        CharSequence text = super.getText();
        if (text instanceof Editable) {
            return (Editable) super.getText();
        }
        super.setText(text, BufferType.EDITABLE);
        return (Editable) super.getText();
        return (Editable) super.getText();
    }
    }