Log better error when trying to access out of bounds value on C# list

This commit is contained in:
2019-02-21 12:18:43 +01:00
parent 685cae2dc6
commit 40745a1935

View File

@@ -62,6 +62,12 @@ namespace Upsilon.BaseTypes.UserData
{
return null;
}
if (i < 0 || i >= List.Count)
{
diagnostics.LogError($"Index out of bounds, index: '{i}'", span);
return new ScriptNull();
}
return List[i].ToScriptType();
}