summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mullvad-daemon/src/account_history.rs8
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