From 48b11d1841ab3cb869689ed87a2a43b81bd519e2 Mon Sep 17 00:00:00 2001 From: Sathish <44555499+sambley@users.noreply.github.com> Date: Wed, 19 Jun 2019 23:15:22 -0700 Subject: [PATCH] Initialize paths for non existent accounts (#4744) --- runtime/src/append_vec.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/src/append_vec.rs b/runtime/src/append_vec.rs index 5b47d2a14..e282d21f6 100644 --- a/runtime/src/append_vec.rs +++ b/runtime/src/append_vec.rs @@ -364,8 +364,8 @@ impl<'a> serde::de::Visitor<'a> for AppendVecVisitor { for dir_path in account_paths.iter() { let fullpath = format!("{}/{}/{}", dir_path, split_path[1], split_path[0]); let file_path = Path::new(&fullpath); + account_path = file_path.to_path_buf(); if file_path.exists() { - account_path = file_path.to_path_buf(); break; } } @@ -498,5 +498,9 @@ pub mod tests { assert_eq!(dav.get_account_test(index2).unwrap(), account2); assert_eq!(dav.get_account_test(index1).unwrap(), account1); std::fs::remove_file(path).unwrap(); + + let mut reader = Cursor::new(&mut buf[..]); + let dav: AppendVec = deserialize_from(&mut reader).unwrap(); + assert!(dav.get_account_test(index2).is_none()); } }