Log better error when trying to access out of bounds value on C# list
This commit is contained in:
parent
685cae2dc6
commit
40745a1935
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue