[System] Avoid an NRE when Close() and Write() are concurrent.
[mono.git] / mcs / class / System / System.Net / WebConnection.cs
index cf07f572effc60a5d98307b4586cf7440d2c2c2c..2033fe9b79f238fbce95963314eec2f480eeacff 100644 (file)
@@ -1166,10 +1166,10 @@ namespace System.Net
                                // if SSL is in use then check for TrustFailure
                                if (ssl) {
 #if SECURITY_DEP && MONOTOUCH
-                                       HttpsClientStream https = (nstream as HttpsClientStream);
+                                       HttpsClientStream https = (s as HttpsClientStream);
                                        if (https.TrustFailure) {
 #else
-                                       if ((bool) piTrustFailure.GetValue (nstream, null)) {
+                                       if ((bool) piTrustFailure.GetValue (, null)) {
 #endif
                                                wes = WebExceptionStatus.TrustFailure;
                                                msg = "Trust failure";