Skip to content

Fix crash on empty cell click in mod_hierarchical_count_table #37

@AliceCYJ58

Description

@AliceCYJ58

I've noticed that when using the hierarchical table module, the app crashes (showing a greyed-out screen) if a user clicks on a cell that contains no patients for a given event. This seems to happen when the subj_ids object is either NULL or empty.

A simple fix is to add a guard clause after the subj_ids assignment (line 610) to prevent further processing when there's no data:
subj_ids <- et()[["df"]][[col]][[row]][["subjid"]]
if (is.null(subj_ids) || length(subj_ids) == 0) return() # <-- new line added
id_elements <- vector(mode = "list", length = (length(subj_ids) * 2) - 1)

This change prevents the crash and has been tested on my local copy of the repository. However, due to company security policy, I'm unable to push the fix myself. Please feel free to implement it on your end.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions