From f6e831d8fbc060f62f27c89c4f4335da53598846 Mon Sep 17 00:00:00 2001
From: Christoph Haag <christoph.haag@collabora.com>
Date: Thu, 13 May 2021 13:51:02 +0200
Subject: [PATCH] steamvr: Don't crash if we don't have bindings for device

---
 src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp b/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp
index dabcf6437..42d773bd3 100644
--- a/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp
+++ b/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp
@@ -489,6 +489,11 @@ public:
 
 			struct profile_template *p = get_profile_template(m_xdev->name);
 
+			if (p == NULL) {
+				ovrd_log("Monado device has unknown profile: %d\n", m_xdev->name);
+				return vr::VRInitError_Unknown;
+			}
+
 			m_input_profile = std::string("{monado}/input/") + std::string(p->steamvr_input_profile_path);
 			m_controller_type = p->steamvr_controller_type;
 		}