From bf9064c2596fb1e5cc5a47d4875f2748b1207a80 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 5cd8edccfd44..a4626b9a5fef 100644 --- a/mcs/class/System/System.Net/WebConnection.cs +++ b/mcs/class/System/System.Net/WebConnection.cs @@ -575,14 +575,18 @@ internal void InitRead () { Stream ns = nstream; - try { - int size = buffer.Length - position; - ns.BeginRead (buffer, position, size, ReadDone, ns); - } catch (Exception e) { - HandleError (WebExceptionStatus.ReceiveFailure, e, "InitRead"); + if (ns != null) { + try { + int size = buffer.Length - position; + ns.BeginRead (buffer, position, size, ReadDone, ns); + } 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) {