Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PatientListViewModel Null Pointer Exception Line 77 #788

Closed
trevorgowing opened this issue Sep 16, 2021 · 4 comments · Fixed by #799
Closed

PatientListViewModel Null Pointer Exception Line 77 #788

trevorgowing opened this issue Sep 16, 2021 · 4 comments · Fixed by #799
Assignees
Labels
type:bug Something isn't working

Comments

@trevorgowing
Copy link

trevorgowing commented Sep 16, 2021

Describe the bug
PatientListViewModel Null Pointer Exception Line 77

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.google.android.fhir.reference, PID: 10872
    java.lang.NullPointerException
        at com.google.android.fhir.reference.PatientListViewModel.getSearchResults(PatientListViewModel.kt:77)
        at com.google.android.fhir.reference.PatientListViewModel$getSearchResults$1.invokeSuspend(Unknown Source:12)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7397)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)

Component
Reference App

To Reproduce
Start the reference app

Expected behavior
The app not to crash

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: HMD Global Nokia 6.1
  • Android version: 10
  • Build number: 00WW_4_15C_SP11
  • Version: N/A

Additional context
I think this is caused by a race condition between the two queries that are executed on view model initialisation.

  • Search Patients
  • Count Patients

On line 77 the result of the Count Patients Query is being used to limit the result of the Search Patients Query.

I am guessing the desired behaviour here is to limit the number of Patients displayed and then page through the remaining Patients, rather than using the result of the count query to limit the search results.

Would you like to work on the issue?
I can work on this issue if desired.

@trevorgowing trevorgowing added the type:bug Something isn't working label Sep 16, 2021
@Tarun-Bhardwaj Tarun-Bhardwaj added this to To do in Demo applications via automation Sep 17, 2021
@Tarun-Bhardwaj
Copy link

Thanks @trevorgowing , the bug has been assigned to you.

@bausmeier
Copy link
Contributor

@trevorgowing Have you managed to take a look at this yet, or can I jump on it?

@trevorgowing
Copy link
Author

@bausmeier No, I have not tackled it yet. It is on my list but if it is blocking you, are you welcome to tackle it and then I can review and test it for you.

@bausmeier
Copy link
Contributor

Okay I'll take it over then. I've got a fix locally, just need to commit and open a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants