From 5cd236c1b069cebecf53dbe6380e39933986eb47 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Fri, 1 Apr 2016 14:16:49 -0700 Subject: [PATCH] Guard against null ref --- .../AuthenticationHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Authentication/AuthenticationHandler.cs b/src/Microsoft.AspNetCore.Authentication/AuthenticationHandler.cs index ebb25af212..639be0103a 100644 --- a/src/Microsoft.AspNetCore.Authentication/AuthenticationHandler.cs +++ b/src/Microsoft.AspNetCore.Authentication/AuthenticationHandler.cs @@ -102,7 +102,7 @@ namespace Microsoft.AspNetCore.Authentication if (ShouldHandleScheme(AuthenticationManager.AutomaticScheme, Options.AutomaticAuthenticate)) { var result = await HandleAuthenticateOnceAsync(); - if (result.Failure != null) + if (result?.Failure != null) { Logger.AuthenticationSchemeNotAuthenticatedWithFailure(Options.AuthenticationScheme, result.Failure.Message); }