Skip to content

Commit

Permalink
Add back in explicit null check to avoid lldb breaking on the null de…
Browse files Browse the repository at this point in the history
…reference
  • Loading branch information
martinpotter committed Jun 21, 2017
1 parent bfa4af9 commit c09eaaa
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions mcs/class/System/System.Net/WebConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -639,14 +639,18 @@ internal void InitRead ()
{
Stream ns = nstream;

try {
int size = buffer.Length - position;
currentNStreamReadAsyncResult = ns.BeginRead (buffer, position, size, ReadDone, null);
} catch (Exception e) {
HandleError (WebExceptionStatus.ReceiveFailure, e, "InitRead");
if (ns != null) {
try {
int size = buffer.Length - position;
currentNStreamReadAsyncResult = ns.BeginRead (buffer, position, size, ReadDone, null);
} catch (Exception e) {
HandleError (WebExceptionStatus.ReceiveFailure, e, "InitRead");
}
} else {
HandleError (WebExceptionStatus.ReceiveFailure, new ArgumentNullException("stream"), "InitRead");
}
}

static int GetResponse (WebConnectionData data, ServicePoint sPoint,
byte [] buffer, int max)
{
Expand Down

0 comments on commit c09eaaa

Please sign in to comment.