Skip to content

Commit

Permalink
prevent that code attempts to read an axis that does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentvanhees committed Jan 29, 2024
1 parent e19fd46 commit 57ea4e2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/g.part5_initialise_ts.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ g.part5_initialise_ts = function(IMP, M, params_247, params_general, longitudina
if (params_general[["sensor.location"]] != "hip") {
longitudinal_axis = NULL
}
if (is.null(longitudinal_axis)) {
if (is.null(longitudinal_axis) && "anglez" %in% names(IMP$metashort)) {
angleName = "anglez"
} else if (longitudinal_axis == 1) {
} else if (longitudinal_axis == 1 && "anglex" %in% names(IMP$metashort)) {
angleName = "anglex"
} else if (longitudinal_axis == 2) {
} else if (longitudinal_axis == 2 && "anglex" %in% names(IMP$metashort)) {
angleName = "angley"
} else if (longitudinal_axis == 3) {
} else if (longitudinal_axis == 3 && "anglex" %in% names(IMP$metashort)) {
angleName = "anglez"

Check warning on line 18 in R/g.part5_initialise_ts.R

View check run for this annotation

Codecov / codecov/patch

R/g.part5_initialise_ts.R#L13-L18

Added lines #L13 - L18 were not covered by tests
}
if (angleName %in% names(IMP$metashort)) {
Expand Down

0 comments on commit 57ea4e2

Please sign in to comment.