rengwuxian / MaterialEditText

EditText in Material Design
6.11k stars 1.04k forks source link

NullPointerException on Layout.getLineForOffset(int) Editor.java file #393

Open jyotisakhareNira opened 4 years ago

jyotisakhareNira commented 4 years ago

Recently migrated the project to AndroidX and below crash is happening only on Android 10 Xiaomi phones. Please help

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.text.Layout.getLineForOffset(int)' on a null object reference at android.widget.Editor$ActionPinnedPopupWindow.computeLocalPosition(Editor.java:3255) at android.widget.Editor$PinnedPopupWindow.show(Editor.java:3577) at android.widget.Editor$ActionPinnedPopupWindow.show(Editor.java:3420) at android.widget.Editor$EmailAddPopupWindow.show(Editor.java:4944) at android.widget.Editor$1.run(Editor.java:1485) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:7509) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)

olegsvs commented 4 years ago

@jyotisakhareNira inputType is email? try https://gist.github.com/olegsvs/b86b43d317a751f77fba683e892ad787

jyotisakhare commented 4 years ago

@olegsvs Yes. Were you able to reproduce the issue?

olegsvs commented 4 years ago

@olegsvs Yes. Were you able to reproduce the issue?

Yes, analog crash report on xiaomi with miui based on android 10 on focus on edittext with email inputType

jyotisakhareNira commented 4 years ago

@olegsvs will include this fix for my next release and let you know whether it worked. I do not have the xiomi device so not able to test

jyotisakhareNira commented 4 years ago

@olegsvs Can you please help with the steps to reproduce this issue?

olegsvs commented 4 years ago

@olegsvs Can you please help with the steps to reproduce this issue?

Focus on edittext with textEmailAddress input type.

choha commented 3 years ago

@jyotisakhareNira has fixed it?

jyotisakhareNira commented 3 years ago

@choha I have replaced it with normal TextInputLayout for Email fields

choha commented 3 years ago

we used AppCompatEditText ,when input email also crash