Skip to content

Commit

Permalink
Add null checks before attempting debug response writing
Browse files Browse the repository at this point in the history
  • Loading branch information
normj committed Oct 20, 2024
1 parent d0a84f2 commit ac0dc72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void Serialize<T>(T response, Stream responseStream)
{
try
{
if (debug)
if (debug && response != null)
{
using (StringWriter debugWriter = new StringWriter())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void Serialize<T>(T response, Stream responseStream)
{
try
{
if (_debug)
if (_debug && response != null)
{
using (var debugStream = new MemoryStream())
using (var utf8Writer = new Utf8JsonWriter(debugStream, WriterOptions))
Expand Down

0 comments on commit ac0dc72

Please sign in to comment.