st/oxr: Fix crash getting ref space bounds in headless mode

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2354>
This commit is contained in:
Rylie Pavlik 2024-08-22 16:42:12 -05:00 committed by Marge Bot
parent e8074ec333
commit 0ca2ddd914

View file

@ -186,6 +186,13 @@ oxr_space_get_reference_bounds_rect(struct oxr_logger *log,
enum xrt_reference_space_type reference_space_type = xr_ref_space_to_xrt(referenceSpaceType);
if (xc == NULL) {
// Headless mode
// `bounds` must be set to 0 on XR_SPACE_BOUNDS_UNAVAILABLE
*bounds = (XrExtent2Df){0};
return XR_SPACE_BOUNDS_UNAVAILABLE;
}
xrt_result_t xret = xrt_comp_get_reference_bounds_rect(xc, reference_space_type, (struct xrt_vec2 *)bounds);
if (xret == XRT_SPACE_BOUNDS_UNAVAILABLE || xret == XRT_ERROR_NOT_IMPLEMENTED) {
// `bounds` must be set to 0 on XR_SPACE_BOUNDS_UNAVAILABLE