Attempt to fix #1553
authorGonzalo Paniagua Javier <gonzalo@xamarin.com>
Thu, 28 Jun 2012 19:48:57 +0000 (15:48 -0400)
committerGonzalo Paniagua Javier <gonzalo@xamarin.com>
Thu, 28 Jun 2012 19:48:57 +0000 (15:48 -0400)
This should prevent a popular exception to happen again.

mcs/class/System/System.Net/WebConnection.cs

index 6169df13609dd57b59ec432c2a793094f6c0e883..0c828cd30c0b98c42d6f9dc1616255f581036630 100644 (file)
@@ -726,7 +726,8 @@ namespace System.Net
                internal void NextRead ()
                {
                        lock (this) {
-                               Data.request.FinishedReading = true;
+                               if (Data.request != null)
+                                       Data.request.FinishedReading = true;
                                string header = (sPoint.UsesProxy) ? "Proxy-Connection" : "Connection";
                                string cncHeader = (Data.Headers != null) ? Data.Headers [header] : null;
                                bool keepAlive = (Data.Version == HttpVersion.Version11 && this.keepAlive);