AnyMemo icon indicating copy to clipboard operation
AnyMemo copied to clipboard

NumberFormatException: Invalid float: "" (Changing Grade)

Open tingsu opened this issue 4 years ago • 2 comments

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

  • Changing Grade 0 to Grade 5 all can trigger the crash.

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)

tingsu avatar Apr 13 '20 14:04 tingsu

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

helloworld1 avatar Apr 13 '20 20:04 helloworld1

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

tingsu avatar Apr 13 '20 20:04 tingsu