Skip to content

Commit

Permalink
fix(UI): prevent crash when no pointer is attached to UI Pointer
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thestonefox committed Oct 5, 2017
1 parent ec0d979 commit f70d9a2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Assets/VRTK/Source/Scripts/Internal/VRTK_VRInputModule.cs
Expand Up @@ -316,7 +316,7 @@ protected virtual void Drag(VRTK_UIPointer pointer, List<RaycastResult> results)

protected virtual void Scroll(VRTK_UIPointer pointer, List<RaycastResult> 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++)
{
Expand Down

0 comments on commit f70d9a2

Please sign in to comment.