diff --git a/src/App/Pages/Accounts/LockPageViewModel.cs b/src/App/Pages/Accounts/LockPageViewModel.cs index d2808268d..673ce6104 100644 --- a/src/App/Pages/Accounts/LockPageViewModel.cs +++ b/src/App/Pages/Accounts/LockPageViewModel.cs @@ -317,8 +317,9 @@ namespace Bit.App.Pages ShowPassword = !ShowPassword; var page = (Page as LockPage); var entry = PinLock ? page.PinEntry : page.MasterPasswordEntry; + var str = PinLock ? Pin : MasterPassword; entry.Focus(); - entry.CursorPosition = PinLock ? Pin.Length : MasterPassword.Length; + entry.CursorPosition = String.IsNullOrEmpty(str) ? 0 : str.Length; } public async Task PromptBiometricAsync() diff --git a/src/App/Pages/Accounts/LoginPageViewModel.cs b/src/App/Pages/Accounts/LoginPageViewModel.cs index faea28307..ab739e465 100644 --- a/src/App/Pages/Accounts/LoginPageViewModel.cs +++ b/src/App/Pages/Accounts/LoginPageViewModel.cs @@ -187,7 +187,7 @@ namespace Bit.App.Pages ShowPassword = !ShowPassword; var entry = (Page as LoginPage).MasterPasswordEntry; entry.Focus(); - entry.CursorPosition = MasterPassword.Length; + entry.CursorPosition = String.IsNullOrEmpty(MasterPassword) ? 0 : MasterPassword.Length; } } } diff --git a/src/App/Pages/Accounts/RegisterPageViewModel.cs b/src/App/Pages/Accounts/RegisterPageViewModel.cs index 8886afa6d..93d7568b3 100644 --- a/src/App/Pages/Accounts/RegisterPageViewModel.cs +++ b/src/App/Pages/Accounts/RegisterPageViewModel.cs @@ -203,7 +203,7 @@ namespace Bit.App.Pages ShowPassword = !ShowPassword; var entry = (Page as RegisterPage).MasterPasswordEntry; entry.Focus(); - entry.CursorPosition = MasterPassword.Length; + entry.CursorPosition = String.IsNullOrEmpty(MasterPassword) ? 0 : MasterPassword.Length; } public void ToggleConfirmPassword() @@ -211,7 +211,7 @@ namespace Bit.App.Pages ShowPassword = !ShowPassword; var entry = (Page as RegisterPage).ConfirmMasterPasswordEntry; entry.Focus(); - entry.CursorPosition = ConfirmMasterPassword.Length; + entry.CursorPosition = String.IsNullOrEmpty(ConfirmMasterPassword) ? 0 : ConfirmMasterPassword.Length; } } }