Skip to content

Commit 003377b

Browse files
committed
Added out of bounds checks to GetBehaviourAtOrderIndex
1 parent 20b8f53 commit 003377b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

MLAPI/MonoBehaviours/Core/NetworkedObject.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,11 @@ internal ushort GetOrderIndex(NetworkedBehaviour instance)
247247

248248
internal NetworkedBehaviour GetBehaviourAtOrderIndex(ushort index)
249249
{
250-
//TODO index out of bounds
250+
if (index >= childNetworkedBehaviours.Count)
251+
{
252+
if (LogHelper.CurrentLogLevel <= LogLevel.Error) LogHelper.LogError("Behaviour index was out of bounds. Did you mess up the order of your NetworkedBehaviours?");
253+
return null;
254+
}
251255
return childNetworkedBehaviours[index];
252256
}
253257
}

0 commit comments

Comments
 (0)