diff options
author | David Snopek <dsnopek@gmail.com> | 2024-08-22 13:03:05 -0500 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-16 17:14:35 +0200 |
commit | 70a8761deb3a8d682f091625a64fbceb2ef26a8c (patch) | |
tree | 3bf81e2a29f385141ca65726d672f621ad7bd3fe /modules/openxr | |
parent | 19bed8fee7ee2afe964ae4e7583f41294b3f54ed (diff) | |
download | redot-engine-70a8761deb3a8d682f091625a64fbceb2ef26a8c.tar.gz |
Fix crash when calling OpenXRAPI::get_hand_tracker() and hand-tracking is disabled
(cherry picked from commit 11dd1f52aeb10e3fb8f236e2e5e050c280764fb9)
Diffstat (limited to 'modules/openxr')
-rw-r--r-- | modules/openxr/openxr_api.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp index 98e5484157..5002d40061 100644 --- a/modules/openxr/openxr_api.cpp +++ b/modules/openxr/openxr_api.cpp @@ -1733,8 +1733,12 @@ void OpenXRAPI::cleanup_extension_wrappers() { XrHandTrackerEXT OpenXRAPI::get_hand_tracker(int p_hand_index) { ERR_FAIL_INDEX_V(p_hand_index, OpenXRHandTrackingExtension::HandTrackedHands::OPENXR_MAX_TRACKED_HANDS, XR_NULL_HANDLE); + + OpenXRHandTrackingExtension *hand_tracking = OpenXRHandTrackingExtension::get_singleton(); + ERR_FAIL_NULL_V(hand_tracking, XR_NULL_HANDLE); + OpenXRHandTrackingExtension::HandTrackedHands hand = static_cast<OpenXRHandTrackingExtension::HandTrackedHands>(p_hand_index); - return OpenXRHandTrackingExtension::get_singleton()->get_hand_tracker(hand)->hand_tracker; + return hand_tracking->get_hand_tracker(hand)->hand_tracker; } Size2 OpenXRAPI::get_recommended_target_size() { |