indomie858 / app-A

Android navigation app for visually impaired students
3 stars 1 forks source link

[Bug] App crashes when clicking on a category, then backing out, then clicking category again #156

Closed indomie858 closed 3 years ago

indomie858 commented 3 years ago

Bug is more apparent on emulator. On phone, it was roughly 4-5 times going back and forth to crash it. Same error everytime

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.appa, PID: 15181
    java.lang.NullPointerException: Attempt to invoke virtual method 'double android.location.Location.getLatitude()' on a null object reference
        at com.example.appa.viewmodel.PlaceViewModel.setNearestEntrance(PlaceViewModel.java:85)
        at com.example.appa.ui.navigationlist.PlaceAdapter.setLocations(PlaceAdapter.java:64)
        at com.example.appa.ui.navigationlist.NavigationListActivity$4.onChanged(NavigationListActivity.java:255)
        at com.example.appa.ui.navigationlist.NavigationListActivity$4.onChanged(NavigationListActivity.java:226)
        at androidx.lifecycle.LiveData.considerNotify(LiveData.java:131)
        at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:149)
        at androidx.lifecycle.LiveData.setValue(LiveData.java:307)
        at androidx.lifecycle.LiveData$1.run(LiveData.java:91)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
indomie858 commented 3 years ago

Merged into dev. See pull request #161 for details