Skip to content

Commit

Permalink
fix(Locomotion): prevent exception with missing player rewind
Browse files Browse the repository at this point in the history
If no PositionRewind script was available for the PlayerClimb script
then it would throw an exception error because no null check was
being done when the PositionRewind script was being called.
  • Loading branch information
thestonefox committed Jun 15, 2017
1 parent 0f7161d commit c690c32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Assets/VRTK/Scripts/Locomotion/VRTK_PlayerClimb.cs
Expand Up @@ -116,7 +116,7 @@ protected virtual void Update()
climbingObjectLastRotation = climbingObject.transform.rotation;
}

if (!IsHeadsetColliding())
if (positionRewind != null && !IsHeadsetColliding())
{
positionRewind.SetLastGoodPosition();
}
Expand Down Expand Up @@ -233,7 +233,7 @@ protected virtual void Grab(GameObject currentGrabbingController, VRTK_Controlle
protected virtual void Ungrab(bool carryMomentum, VRTK_ControllerReference controllerReference, GameObject target)
{
isClimbing = false;
if (IsHeadsetColliding())
if (positionRewind != null && IsHeadsetColliding())
{
positionRewind.RewindPosition();
}
Expand Down

0 comments on commit c690c32

Please sign in to comment.