From f70d9a250524fc0d0a389659774a85d4e02486ef Mon Sep 17 00:00:00 2001 From: Harvey Ball Date: Thu, 5 Oct 2017 17:56:19 +0100 Subject: [PATCH] fix(UI): prevent crash when no pointer is attached to UI Pointer There was an issue where the VRInputModule would crash if no controller was attached to the UI Pointer because it was trying to access a controller to get the touchpad axis data for the scroll amount. This has been fixed by checking for the existence of a controller. --- Assets/VRTK/Source/Scripts/Internal/VRTK_VRInputModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/VRTK/Source/Scripts/Internal/VRTK_VRInputModule.cs b/Assets/VRTK/Source/Scripts/Internal/VRTK_VRInputModule.cs index 0b8776e40..a0e58bcbc 100644 --- a/Assets/VRTK/Source/Scripts/Internal/VRTK_VRInputModule.cs +++ b/Assets/VRTK/Source/Scripts/Internal/VRTK_VRInputModule.cs @@ -316,7 +316,7 @@ protected virtual void Drag(VRTK_UIPointer pointer, List results) protected virtual void Scroll(VRTK_UIPointer pointer, List results) { - pointer.pointerEventData.scrollDelta = pointer.controller.GetTouchpadAxis(); + pointer.pointerEventData.scrollDelta = (pointer.controller != null ? pointer.controller.GetTouchpadAxis() : Vector2.zero); bool scrollWheelVisible = false; for (int i = 0; i < results.Count; i++) {