Skip to content

Commit

Permalink
Prevent NullReferenceException on login when account is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessecar96 committed Jun 17, 2017
1 parent 820c597 commit be349ae
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Steam Desktop Authenticator/LoginForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,23 @@ public LoginForm(LoginType loginReason = LoginType.Initial, SteamGuardAccount ac
this.LoginReason = loginReason;
this.androidAccount = account;

if (this.LoginReason != LoginType.Initial)
try
{
txtUsername.Text = account.AccountName;
txtUsername.Enabled = false;
}
if (this.LoginReason != LoginType.Initial)
{
txtUsername.Text = account.AccountName;
txtUsername.Enabled = false;
}

if (this.LoginReason == LoginType.Refresh)
if (this.LoginReason == LoginType.Refresh)
{
labelLoginExplanation.Text = "Your Steam credentials have expired. For trade and market confirmations to work properly, please login again.";
}
}
catch (Exception)
{
labelLoginExplanation.Text = "Your Steam credentials have expired. For trade and market confirmations to work properly, please login again.";
MessageBox.Show("Failed to find your account. Try closing and re-opening SDA.", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.Close();
}
}

Expand Down

0 comments on commit be349ae

Please sign in to comment.