Skip to content

Commit 529532c

Browse files
committed
fix(AxisCreator): prevent null exception if no axis found
There was an issue when no axis was found it would throw a null exception as the `Next` call would try and iterate through to a null element. This is resolved by just using the resulting bool from the `Next` call to ensure whether it can proceed wit the additional check.
1 parent 571d134 commit 529532c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Editor/UnityInputManagerAxisCreator.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,10 @@ private static bool AxisDefined(string axisName)
182182
while (axesProperty.Next(false))
183183
{
184184
SerializedProperty axis = axesProperty.Copy();
185-
axis.Next(true);
186-
if (axis.stringValue == axisName) return true;
185+
if (axis.Next(true))
186+
{
187+
if (axis.stringValue == axisName) return true;
188+
}
187189
}
188190
return false;
189191
}

0 commit comments

Comments
 (0)