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
+8
@@ -437,8 +437,16 @@ 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();
|
||||||
|
try
|
||||||
|
{
|
||||||
return items.get(normalizeIndex(index, items.size()));
|
return items.get(normalizeIndex(index, items.size()));
|
||||||
}
|
}
|
||||||
|
catch (ArithmeticException are)
|
||||||
|
{
|
||||||
|
if (items.isEmpty()) return Value.NULL;
|
||||||
|
throw are;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean has(Value where)
|
public boolean has(Value where)
|
||||||
|
|||||||
Reference in new issue
Block a user