From 8e6663a4dffd242d84ecd19ee5c5cb546837f6c6 Mon Sep 17 00:00:00 2001 From: Erin Nova Date: Sat, 17 Jul 2021 18:32:47 -0400 Subject: [PATCH] Should have fixed index overflow in write_json --- src/file_io.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file_io.rs b/src/file_io.rs index b31f15b..0efecdc 100644 --- a/src/file_io.rs +++ b/src/file_io.rs @@ -83,7 +83,7 @@ pub fn write_json(users_list: &Vec) -> Result<()> { for i in 0..users_list.len() { // Serialize the users users_json += &serde_json::to_string(&users_list[i])?; - if i <= users_list.len()-2 { // don't append newline if it's the last element + if i != users_list.len()-1 { // don't append newline if it's the last element users_json += "\n"; } }