summaryrefslogtreecommitdiff
path: root/modules/openxr/openxr_interface.cpp
diff options
context:
space:
mode:
authoravemort <666mon@gmail.com>2022-11-11 09:49:28 -0300
committeravemort <666mon@gmail.com>2022-11-11 11:00:34 -0300
commit8ef1719945743b916a112a2e6a0709ce71e7eacf (patch)
treef33caefb2d2502abbb87c31e7a6eca04f67382d5 /modules/openxr/openxr_interface.cpp
parent140f0395470975f1c20648ffd8807be113a9e373 (diff)
Add index check to OpenXRInterface::get_projection_for_view and OpenXRInterface::get_transform_for_view
Diffstat (limited to 'modules/openxr/openxr_interface.cpp')
-rw-r--r--modules/openxr/openxr_interface.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/openxr/openxr_interface.cpp b/modules/openxr/openxr_interface.cpp
index be6b7e4411..1db8f5e665 100644
--- a/modules/openxr/openxr_interface.cpp
+++ b/modules/openxr/openxr_interface.cpp
@@ -666,6 +666,7 @@ Transform3D OpenXRInterface::get_camera_transform() {
Transform3D OpenXRInterface::get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) {
XRServer *xr_server = XRServer::get_singleton();
ERR_FAIL_NULL_V(xr_server, Transform3D());
+ ERR_FAIL_INDEX_V_MSG(p_view, get_view_count(), Transform3D(), "View index outside bounds.");
Transform3D t;
if (openxr_api && openxr_api->get_view_transform(p_view, t)) {
@@ -685,6 +686,7 @@ Transform3D OpenXRInterface::get_transform_for_view(uint32_t p_view, const Trans
Projection OpenXRInterface::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) {
Projection cm;
+ ERR_FAIL_INDEX_V_MSG(p_view, get_view_count(), cm, "View index outside bounds.");
if (openxr_api) {
if (openxr_api->get_view_projection(p_view, p_z_near, p_z_far, cm)) {