From 7a55686ebefc40c3c0516620b3c1840078b78351 Mon Sep 17 00:00:00 2001 From: Martin Potter Date: Wed, 21 Jun 2017 14:58:44 -0700 Subject: [PATCH] Add back in explicit null check to avoid lldb breaking on the null dereference --- mcs/class/System/System.Net/WebConnection.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mcs/class/System/System.Net/WebConnection.cs b/mcs/class/System/System.Net/WebConnection.cs index 97c6c23e12db..e042b9fc1df9 100644 --- a/mcs/class/System/System.Net/WebConnection.cs +++ b/mcs/class/System/System.Net/WebConnection.cs @@ -577,14 +577,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) {