Fix bug related to collection modification during Application.Restart() on ChangePassword.

This commit is contained in:
Junior 2023-10-05 23:36:56 -03:00
parent 46b2b6f15d
commit d5ec712d0f
3 changed files with 26 additions and 15 deletions

View file

@ -460,19 +460,24 @@ namespace RHLauncher
public void Logout()
{
LoginForm? loginForm = Application.OpenForms.OfType<LoginForm>().FirstOrDefault();
LoginForm loginForm = Application.OpenForms.OfType<LoginForm>().FirstOrDefault();
if (loginForm != null)
{
// Close the current form before restarting
Close();
// Restart the application
Application.Restart();
}
else
{
LoginForm newLoginForm = new();
LoginForm newLoginForm = new LoginForm();
newLoginForm.Show();
Close();
}
}
private async void UpdateCheckButton_Click(object sender, EventArgs e)
{
HidePanels();