From 77096c1702238301524664cfb6590a5ab4ff272c Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Tue, 21 Apr 2020 15:36:30 +0530 Subject: BaseGitActivity: don't remove saved password unnecessarily if previousUrl is empty it means that this the first time the method is being called, and url has not been built yet. We let things slide for the first pass so that the actual logic only kicks in when it needs to. Signed-off-by: Harsh Shandilya --- app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt b/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt index 2cfeebae..4d5ef66a 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt @@ -126,7 +126,7 @@ abstract class BaseGitActivity : AppCompatActivity() { PasswordRepository.addRemote("origin", newUrl, true) // HTTPS authentication sends the password to the server, so we must wipe the password when // the server is changed. - if (newUrl != previousUrl && protocol == Protocol.Https) + if (previousUrl.isNotEmpty() && newUrl != previousUrl && protocol == Protocol.Https) encryptedSettings.edit { remove("https_password") } url = newUrl return true -- cgit v1.2.3