You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that I found a bug when working with arrays.
It seems that after trying to take a value with an out of bounds index from an array JsonValue, the len of the array changes.
Minimal code to illustrate:
fnmain(){letmut array = json::parse(&create_data(10)).unwrap();assert_eq!(array.len(), 10);
array[9].take();assert_eq!(array.len(), 10);println!("len correct after taking element from index 9");
array[10].take();assert_eq!(array.len(), 10);}fncreate_data(len:usize) -> String{letmut data = String::from("[");for i in0..len {
data.push_str(r#"{"hello": 1}"#);if i != len - 1{
data.push(',');}}
data.push(']');
data
}
Outputs:
len correct after taking element from index 9
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `11`,
right: `10`', src/main.rs:13:5
The text was updated successfully, but these errors were encountered:
Hello!
First, thank you for this great crate!
I believe that I found a bug when working with arrays.
It seems that after trying to
take
a value with an out of bounds index from an arrayJsonValue
, thelen
of the array changes.Minimal code to illustrate:
Outputs:
The text was updated successfully, but these errors were encountered: