Skip to content

Commit 1957225

Browse files
committed
Guard against a potential null ref
1 parent 34c7f6e commit 1957225

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Assets/MRTK/Core/Definitions/Devices/ArticulatedHandDefinition.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,9 @@ public bool IsInPointingPose
131131
if (unityJointPoses.TryGetValue(TrackedHandJoint.Palm, out palmJoint))
132132
{
133133
Vector3 palmNormal = palmJoint.Rotation * (-1 * Vector3.up);
134-
if (cursorBeamBackwardTolerance >= 0)
134+
if (cursorBeamBackwardTolerance >= 0 && CameraCache.Main != null)
135135
{
136-
Vector3 cameraBackward = -CameraCache.Main.transform.forward;
137-
if (Vector3.Dot(palmNormal.normalized, cameraBackward) > cursorBeamBackwardTolerance)
136+
if (Vector3.Dot(palmNormal.normalized, -CameraCache.Main.transform.forward) > cursorBeamBackwardTolerance)
138137
{
139138
return false;
140139
}

0 commit comments

Comments
 (0)