opensrp / opensrp-client-goldsmith

0 stars 0 forks source link

Fix crash happening on task page when location changes #55

Open ekigamba opened 3 years ago

ekigamba commented 3 years ago
  1. Open the tasks page
  2. Go to the map
  3. Open the location emulation control for the emulator
  4. Change the location

The app also crashes if the location changes while on the tasks page

Error while on the tasks page

2021-01-15 17:32:11.652 2731-2842/org.smartregister.goldsmith E/AndroidRuntime: FATAL EXCEPTION: pool-5-thread-1
    Process: org.smartregister.goldsmith, PID: 2731
    java.lang.NullPointerException: Attempt to invoke virtual method 'float android.location.Location.distanceTo(android.location.Location)' on a null object reference
        at org.smartregister.tasking.interactor.TaskRegisterFragmentInteractor.lambda$calculateDistanceFromUser$3$TaskRegisterFragmentInteractor(TaskRegisterFragmentInteractor.java:372)
        at org.smartregister.tasking.interactor.-$$Lambda$TaskRegisterFragmentInteractor$EKSjO6g-TpDkJLoQ9jZlavB3fDc.run(lambda)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)

Error while on the map

at java.lang.Thread.run(Thread.java:761)
2021-01-15 17:20:48.805 1921-1921/org.smartregister.goldsmith E/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.smartregister.goldsmith, PID: 1921
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
        at org.smartregister.tasking.presenter.TaskRegisterFragmentPresenter.onTasksFound(TaskRegisterFragmentPresenter.java:223)
        at org.smartregister.tasking.interactor.TaskRegisterFragmentInteractor.lambda$null$2$TaskRegisterFragmentInteractor(TaskRegisterFragmentInteractor.java:383)
        at org.smartregister.tasking.interactor.-$$Lambda$TaskRegisterFragmentInteractor$TvwbWejtI-yvu63EZDj_FoPAgnE.run(lambda)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)