fix index panicking when using int index

This commit is contained in:
Robin Appelman 2021-08-03 16:35:47 +02:00
commit 7a98bf4825

View file

@ -463,7 +463,7 @@ impl Index<i64> for Value {
fn index(&self, index: i64) -> &Self::Output {
match self {
Value::Array(map) => map.index(&Key::Int(index)),
Value::Array(map) => map.get(&Key::Int(index)).unwrap_or(&Value::Null),
_ => &Value::Null,
}
}