Skip to content

Commit 666922b

Browse files
committed
string null check
1 parent e3fa1c4 commit 666922b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/AspNetCore6Plus/BrowserInjectingStreamWrapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ private bool IsHtmlResponse(bool forceReCheck = false)
158158
// * UTF-8 formatted (either explicitly or no charset defined)
159159
var responseContentType = _context.Response.ContentType;
160160
_isHtmlResponse =
161+
!string.IsNullOrEmpty(responseContentType) &&
161162
responseContentType.Contains("text/html", StringComparison.OrdinalIgnoreCase) &&
162163
(responseContentType.Contains("utf-8", StringComparison.OrdinalIgnoreCase) ||
163164
!responseContentType.Contains("charset=", StringComparison.OrdinalIgnoreCase));
@@ -188,8 +189,7 @@ private bool IsHtmlResponse(bool forceReCheck = false)
188189

189190
private void LogExceptionAndDisable(Exception e)
190191
{
191-
_agent.Logger.Log(Level.Error,
192-
$"Unexpected exception. Browser injection will be disabled. Exception: {e.Message}: {e.StackTrace}");
192+
_agent.Logger.Log(Level.Error, e, "Unexpected exception. Browser injection will be disabled.");
193193

194194
Disabled = true;
195195
}

0 commit comments

Comments
 (0)