check password for null before setting cursor position (#1586)

This commit is contained in:
Jake Fink 2021-10-15 10:56:12 -04:00 committed by GitHub
parent 17b89dc21c
commit f3ff991abe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

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

View File

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

View File

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