Skip to content

Commit 61c600c

Browse files
authored
Added checks to inspector code to prevent null errors (#9943)
1 parent 980cc56 commit 61c600c

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

Assets/MRTK/SDK/Editor/Inspectors/UX/Interactable/InteractableInspector.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,12 +556,26 @@ public static bool TryGetInputActions(out string[] descriptionsArray)
556556
return false;
557557
}
558558

559-
MixedRealityInputAction[] actions = CoreServices.InputSystem.InputSystemProfile.InputActionsProfile.InputActions;
559+
MixedRealityInputSystemProfile inputSystemProfile = CoreServices.InputSystem?.InputSystemProfile;
560560

561-
descriptionsArray = new string[actions.Length];
562-
for (int i = 0; i < actions.Length; i++)
561+
if (inputSystemProfile != null && inputSystemProfile.SpeechCommandsProfile != null)
563562
{
564-
descriptionsArray[i] = actions[i].Description;
563+
MixedRealityInputAction[] actions = inputSystemProfile.InputActionsProfile.InputActions;
564+
565+
descriptionsArray = new string[actions.Length];
566+
for (int i = 0; i < actions.Length; i++)
567+
{
568+
descriptionsArray[i] = actions[i].Description;
569+
}
570+
}
571+
else
572+
{
573+
descriptionsArray = null;
574+
}
575+
576+
if (descriptionsArray == null || descriptionsArray.Length < 1)
577+
{
578+
return false;
565579
}
566580

567581
return true;

0 commit comments

Comments
 (0)