From c09eaaaec81fed17ff3b2e0a23b3fdb0d9485978 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 b154e0ff5ca7..d098948d71e3 100644 --- a/mcs/class/System/System.Net/WebConnection.cs +++ b/mcs/class/System/System.Net/WebConnection.cs @@ -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) {