Skip to content

Commit

Permalink
#3235 Fix issue with null reference when throwing exception (backport…
Browse files Browse the repository at this point in the history
… to version 7) (#4301)

Co-authored-by: tkyle <[email protected]>
Co-authored-by: Rockford Lhotka <[email protected]>
  • Loading branch information
3 people authored Nov 13, 2024
1 parent 9a6b43e commit 2e524d0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Source/Csla/DataPortalClient/HttpProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,16 @@ private byte[] CallViaWebClient(byte[] serialized, string operation, string rout
catch (WebException ex)
{
string message;
using (var reader = new System.IO.StreamReader(ex.Response.GetResponseStream()))
message = reader.ReadToEnd();
if (ex.Response != null)
{
using (var reader = new System.IO.StreamReader(ex.Response.GetResponseStream()))
message = reader.ReadToEnd();
}
else
{
message = ex.Message;
}

throw new DataPortalException(message, ex);
}
}
Expand Down

0 comments on commit 2e524d0

Please sign in to comment.