Skip to content

Commit 49f7721

Browse files
author
David Kline (ANALOG)
committed
add null check
1 parent c06e718 commit 49f7721

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Assets/HoloToolkit/Input/Scripts/Focus/FocusManager.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,10 @@ public GameObject TryGetFocusedObject(BaseEventData eventData)
353353

354354
public bool TryGetPointingSource(BaseEventData eventData, out IPointingSource pointingSource)
355355
{
356+
// pre-initialize pointingSource to null, assuming we will return false
357+
pointingSource = null;
358+
if (eventData == null) { return false; }
359+
356360
for (int i = 0; i < pointers.Count; i++)
357361
{
358362
if (pointers[i].PointingSource.OwnsInput(eventData))
@@ -362,7 +366,6 @@ public bool TryGetPointingSource(BaseEventData eventData, out IPointingSource po
362366
}
363367
}
364368

365-
pointingSource = null;
366369
return false;
367370
}
368371

0 commit comments

Comments
 (0)