maityamit / Sleepometer-Android-App

Sleepometer Android App , measure your sleep and track. This will basically measure your sleep, and represent the overall day-wise sleep hours and the last 7 days' average sleep also can measure.
https://play.google.com/store/apps/details?id=sleepometerbyamitmaity.example.sleepometer
MIT License
25 stars 41 forks source link

[Bug]: The 'MissClick?' Time picker is not null safe #57

Closed aryanmishra29 closed 1 year ago

aryanmishra29 commented 1 year ago

Contact Details

aryan29mishra@gmail.com

What happened?

When we click on the MissClick? button for the first time and click save without setting any time, then the app crashes. We need to make it null safe by doing a few changes to the java code.

Screenshot 2023-02-03 at 12 39 21 PM

Relevant log output

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.widget.TimePicker.getHour()' on a null object reference
        at sleepometerbyamitmaity.example.sleepometer.fragments.HomeFragment$7.onClick(HomeFragment.java:223)
        at androidx.appcompat.app.AlertController$ButtonHandler.handleMessage(AlertController.java:167)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

Code of Conduct

aryanmishra29 commented 1 year ago

@maityamit Kindly review the issue, and assign it to me under IWOC label. I will make the time picker null safe using some checks and conditions.

maityamit commented 1 year ago

@aryanmishra29 start :)

maityamit commented 1 year ago

@aryanmishra29 any update ?

aryanmishra29 commented 1 year ago

Just now made a PR, Kindly review it!