Log better error when trying to access out of bounds value on C# list
This commit is contained in:
@@ -62,6 +62,12 @@ namespace Upsilon.BaseTypes.UserData
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i < 0 || i >= List.Count)
|
||||||
|
{
|
||||||
|
diagnostics.LogError($"Index out of bounds, index: '{i}'", span);
|
||||||
|
return new ScriptNull();
|
||||||
|
}
|
||||||
return List[i].ToScriptType();
|
return List[i].ToScriptType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user