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 <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya
2020-04-21 15:36:30 +05:30
parent 47c2875e93
commit 77096c1702

View File

@@ -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