diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2017-09-27 15:41:59 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2017-09-27 15:41:59 +0200 |
| commit | 0db3894b92a0d78703791c45fea581567e7b15bc (patch) | |
| tree | 891f110f516e01a9187343b3ed27046418748db2 | |
| parent | 86d3f4746e56a5b3db0ca0afe7fb017e5db0fc4c (diff) | |
| download | mullvadvpn-0db3894b92a0d78703791c45fea581567e7b15bc.tar.xz mullvadvpn-0db3894b92a0d78703791c45fea581567e7b15bc.zip | |
Make setting empty account number same as unsetting
| -rw-r--r-- | mullvad-daemon/src/settings.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mullvad-daemon/src/settings.rs b/mullvad-daemon/src/settings.rs index 230f7fcedf..4637929949 100644 --- a/mullvad-daemon/src/settings.rs +++ b/mullvad-daemon/src/settings.rs @@ -98,7 +98,11 @@ impl Settings { /// Changes account number to the one given. Also saves the new settings to disk. /// The boolean in the Result indicates if the account token changed or not - pub fn set_account_token(&mut self, account_token: Option<String>) -> Result<bool> { + pub fn set_account_token(&mut self, mut account_token: Option<String>) -> Result<bool> { + if account_token.as_ref().map(String::len) == Some(0) { + debug!("Setting empty account token is treated as unsetting it"); + account_token = None; + } if account_token != self.account_token { info!( "Changing account token from {} to {}", |
