From 0f40a4be8f5c0cce76672ce38a99ddc775478285 Mon Sep 17 00:00:00 2001 From: Moses Turner Date: Sun, 21 Aug 2022 23:54:12 +0100 Subject: [PATCH] t/c/builder_lighthouse: Fail more clearly when cameras aren't available --- src/xrt/targets/common/target_builder_lighthouse.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/xrt/targets/common/target_builder_lighthouse.c b/src/xrt/targets/common/target_builder_lighthouse.c index 3e86e7d53..d1f713beb 100644 --- a/src/xrt/targets/common/target_builder_lighthouse.c +++ b/src/xrt/targets/common/target_builder_lighthouse.c @@ -638,8 +638,21 @@ lighthouse_open_system(struct xrt_builder *xb, lhs.vive_tstatus.hand_enabled = false; } + + bool success = true; + if (hmd_config == NULL) { + // This should NEVER happen, but we're not writing Rust. + U_LOG_E("Didn't get a vive config? Not creating visual trackers."); + goto end; + } + if (!hmd_config->cameras.valid) { + U_LOG_I( + "HMD didn't have cameras or didn't have a valid camera calibration. Not creating visual trackers."); + goto end; + } + struct xrt_slam_sinks sinks = {0}; struct xrt_device *hand_devices[2] = {NULL}; success = setup_visual_trackers(usysd, xp, hmd_config, &sinks, hand_devices);