Pulling in from empty list container returns null like for other containers. Fixes #660

This commit is contained in:
gnembon committed 2021-06-11 00:37:45 -03:00
1 parent 8297000b88
commit 7ee313134e
1 file changed
+9 -1
@@ -437,7 +437,15 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
public Value get(Value value)
{
long index = NumericValue.asNumber(value, "'address' to a list index").getLong();
return items.get(normalizeIndex(index, items.size()));
try
{
return items.get(normalizeIndex(index, items.size()));
}
catch (ArithmeticException are)
{
if (items.isEmpty()) return Value.NULL;
throw are;
}
}
@Override