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 22, 2024
1 parent d0a84f2 commit 215fc55
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>Amazon.Lambda.Serialization.Json</AssemblyName>
<PackageId>Amazon.Lambda.Serialization.Json</PackageId>
<PackageTags>AWS;Amazon;Lambda</PackageTags>
<VersionPrefix>2.2.3</VersionPrefix>
<VersionPrefix>2.2.4</VersionPrefix>
</PropertyGroup>

<ItemGroup>
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>Amazon.Lambda.Serialization.SystemTextJson</AssemblyName>
<PackageId>Amazon.Lambda.Serialization.SystemTextJson</PackageId>
<PackageTags>AWS;Amazon;Lambda</PackageTags>
<VersionPrefix>2.4.3</VersionPrefix>
<VersionPrefix>2.4.4</VersionPrefix>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void Serialize<T>(T response, Stream responseStream)
{
try
{
if (_debug)
if (_debug && response != null)
{
using (var debugWriter = new StringWriter())
using (var utf8Writer = new Utf8JsonWriter(responseStream, WriterOptions))
Expand Down

0 comments on commit 215fc55

Please sign in to comment.