From a8eb098e1435ead3ffc8ffe2534a897e29976bd3 Mon Sep 17 00:00:00 2001 From: Mateo de Mayo Date: Wed, 13 Mar 2024 14:45:14 -0400 Subject: [PATCH] drivers: don't initialize masks_sink if slam is disabled Co-authored-by: Simon Zeni --- src/xrt/drivers/rift_s/rift_s_tracker.c | 2 +- src/xrt/drivers/wmr/wmr_hmd.c | 2 +- src/xrt/targets/common/target_builder_lighthouse.c | 2 +- src/xrt/targets/common/target_builder_north_star.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xrt/drivers/rift_s/rift_s_tracker.c b/src/xrt/drivers/rift_s/rift_s_tracker.c index 7b9fcd735..f8239297c 100644 --- a/src/xrt/drivers/rift_s/rift_s_tracker.c +++ b/src/xrt/drivers/rift_s/rift_s_tracker.c @@ -404,7 +404,7 @@ rift_s_tracker_create(struct xrt_tracking_origin *origin, // Initialize hand tracker struct xrt_slam_sinks *hand_sinks = NULL; struct xrt_device *hand_device = NULL; - struct xrt_hand_masks_sink *masks_sink = slam_sinks->hand_masks; + struct xrt_hand_masks_sink *masks_sink = slam_sinks ? slam_sinks->hand_masks : NULL; if (t->tracking.hand_enabled) { int hand_status = rift_s_create_hand_tracker(t, xfctx, masks_sink, &hand_sinks, &hand_device); if (hand_status != 0 || hand_sinks == NULL || hand_device == NULL) { diff --git a/src/xrt/drivers/wmr/wmr_hmd.c b/src/xrt/drivers/wmr/wmr_hmd.c index db6b2682b..b04ee2b44 100644 --- a/src/xrt/drivers/wmr/wmr_hmd.c +++ b/src/xrt/drivers/wmr/wmr_hmd.c @@ -1872,7 +1872,7 @@ wmr_hmd_setup_trackers(struct wmr_hmd *wh, struct xrt_slam_sinks *out_sinks, str // Initialize hand tracker struct xrt_slam_sinks *hand_sinks = NULL; struct xrt_device *hand_device = NULL; - struct xrt_hand_masks_sink *masks_sink = slam_sinks->hand_masks; + struct xrt_hand_masks_sink *masks_sink = slam_sinks ? slam_sinks->hand_masks : NULL; if (wh->tracking.hand_enabled) { int hand_status = wmr_hmd_hand_track(wh, stereo_calib, masks_sink, &hand_sinks, &hand_device); if (hand_status != 0 || hand_sinks == NULL || hand_device == NULL) { diff --git a/src/xrt/targets/common/target_builder_lighthouse.c b/src/xrt/targets/common/target_builder_lighthouse.c index c81bc1e9e..f58782ff6 100644 --- a/src/xrt/targets/common/target_builder_lighthouse.c +++ b/src/xrt/targets/common/target_builder_lighthouse.c @@ -385,7 +385,7 @@ valve_index_setup_visual_trackers(struct lighthouse_system *lhs, // Initialize hand tracker struct xrt_slam_sinks *hand_sinks = NULL; struct xrt_device *hand_devices[2] = {NULL}; - struct xrt_hand_masks_sink *masks_sink = (slam_enabled ? slam_sinks->hand_masks : NULL); + struct xrt_hand_masks_sink *masks_sink = slam_sinks ? slam_sinks->hand_masks : NULL; if (hand_enabled) { bool success = valve_index_hand_track( // lhs, // diff --git a/src/xrt/targets/common/target_builder_north_star.c b/src/xrt/targets/common/target_builder_north_star.c index b4addeff3..070279948 100644 --- a/src/xrt/targets/common/target_builder_north_star.c +++ b/src/xrt/targets/common/target_builder_north_star.c @@ -308,7 +308,7 @@ ns_setup_depthai_device(struct ns_builder *nsb, #ifdef XRT_BUILD_DRIVER_HANDTRACKING struct xrt_slam_sinks *hand_sinks = NULL; - struct xrt_hand_masks_sink *masks_sink = slam_sinks->hand_masks; + struct xrt_hand_masks_sink *masks_sink = slam_sinks ? slam_sinks->hand_masks : NULL; struct t_camera_extra_info extra_camera_info = {0};