Pulling in from empty list container returns null like for other containers. Fixes #660
This commit is contained in:
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)
|
public Value get(Value value)
|
||||||
{
|
{
|
||||||
long index = NumericValue.asNumber(value, "'address' to a list index").getLong();
|
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
|
@Override
|
||||||
|
|||||||
Reference in new issue
Block a user