helloworld1 / AnyMemo

Advanced Spaced Repetition flashcard learning software for Android.
http://www.anymemo.org
GNU General Public License v2.0
151 stars 53 forks source link

NumberFormatException: Invalid float: "" (Changing Grade) #493

Open tingsu opened 4 years ago

tingsu commented 4 years ago

I searched the history issue list, and have not found similar issues.

The issue was found in the latest released version (v10.11.4) on a Android 6.0 device.

Reproducing viodeo

20200413_162427

Desciption

Crash stack

 FATAL EXCEPTION: main
 Process: org.liberty.android.fantastischmemo, PID: 20778
 java.lang.NumberFormatException: Invalid float: ""
    at java.lang.StringToReal.invalidReal(StringToReal.java:63)
    at java.lang.StringToReal.parseFloat(StringToReal.java:308)
    at java.lang.Float.parseFloat(Float.java:306)
    at java.lang.Float.valueOf(Float.java:343)
    at org.liberty.android.fantastischmemo.ui.widgets.FloatEditTextPreference.persistString(FloatEditTextPreference.java:53)
    at android.preference.EditTextPreference.setText(EditTextPreference.java:92)
    at android.preference.EditTextPreference.onDialogClosed(EditTextPreference.java:146)
    at android.preference.DialogPreference.onDismiss(DialogPreference.java:395)
    at android.app.Dialog$ListenersHandler.handleMessage(Dialog.java:1323)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
helloworld1 commented 4 years ago

There is no validation on the user input there so it will crash on invalid input

tingsu commented 4 years ago

Yes, thanks for your confirmation and explanation. I think this could be easily fixed :)