diff options
| author | Emīls Piņķis <emils@mullvad.net> | 2019-03-05 13:11:29 +0000 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2019-03-05 13:11:29 +0000 |
| commit | 418760ab66d2b6d9d1ccae0acd70df84b4390591 (patch) | |
| tree | 2012033f86e060588e2431320ec8c61a846ddc45 | |
| parent | 6bd6acc2f61f31a67f3dbd5091cf6cb287d6b78d (diff) | |
| parent | da05bb7c8189f8787aa7bccb9e8525d0ad486b83 (diff) | |
| download | mullvadvpn-418760ab66d2b6d9d1ccae0acd70df84b4390591.tar.xz mullvadvpn-418760ab66d2b6d9d1ccae0acd70df84b4390591.zip | |
Merge branch 'fix-old-account-history'
| -rw-r--r-- | mullvad-daemon/src/account_history.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mullvad-daemon/src/account_history.rs b/mullvad-daemon/src/account_history.rs index e79356d257..b29640c13e 100644 --- a/mullvad-daemon/src/account_history.rs +++ b/mullvad-daemon/src/account_history.rs @@ -69,10 +69,16 @@ impl AccountHistory { } fn try_old_format(reader: &mut io::BufReader<fs::File>) -> Result<Vec<AccountToken>> { + #[derive(Deserialize)] + struct OldFormat { + accounts: Vec<AccountToken>, + } reader .seek(io::SeekFrom::Start(0)) .chain_err(|| ErrorKind::ReadError)?; - Ok(serde_json::from_reader(reader).unwrap_or(vec![])) + Ok(serde_json::from_reader(reader) + .map(|old_format: OldFormat| old_format.accounts) + .unwrap_or(vec![])) } /// Gets account data for a certain account id and bumps it's entry to the top of the list if |
