Minor improvements (#1403)

* Fixed exception overwriting due to possible NullReferenceException

* Removed unused local variables
This commit is contained in:
agoretsky 2017-09-19 19:14:49 +03:00 committed by Chris Ross
parent eff1b42d6e
commit 241880eadc
2 changed files with 3 additions and 4 deletions

View File

@ -132,7 +132,6 @@ namespace Microsoft.AspNetCore.Authentication.Cookies
}
var currentUtc = Clock.UtcNow;
var issuedUtc = ticket.Properties.IssuedUtc;
var expiresUtc = ticket.Properties.ExpiresUtc;
if (expiresUtc != null && expiresUtc.Value < currentUtc)
@ -246,7 +245,7 @@ namespace Microsoft.AspNetCore.Authentication.Cookies
_signInCalled = true;
// Process the request cookie to initialize members like _sessionKey.
var result = await EnsureCookieTicket();
await EnsureCookieTicket();
var cookieOptions = BuildCookieOptions();
var signInContext = new CookieSigningInContext(
@ -328,7 +327,7 @@ namespace Microsoft.AspNetCore.Authentication.Cookies
_signOutCalled = true;
// Process the request cookie to initialize members like _sessionKey.
var ticket = await EnsureCookieTicket();
await EnsureCookieTicket();
var cookieOptions = BuildCookieOptions();
if (Options.SessionStore != null && _sessionKey != null)
{

View File

@ -70,7 +70,7 @@ namespace Microsoft.AspNetCore.Authentication
new InvalidOperationException("Invalid return state, unable to redirect.");
}
ticket = authResult.Ticket;
ticket = authResult?.Ticket;
}
catch (Exception ex)
{