diff --git a/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs b/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs index 7e743dc3cca7..496a620dc1d6 100644 --- a/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs +++ b/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs @@ -725,6 +725,9 @@ internal AsyncOperationStatus ProcessHandshake (AsyncOperationStatus status, boo internal (int ret, bool wantMore) ProcessRead (BufferOffsetSize userBuffer) { lock (ioLock) { + if (xobileTlsContext == null) + return (0, false); + // This operates on the internal buffer and will never block. if (operation != Operation.Authenticated) throw GetInternalError (); @@ -740,6 +743,9 @@ internal AsyncOperationStatus ProcessHandshake (AsyncOperationStatus status, boo internal (int ret, bool wantMore) ProcessWrite (BufferOffsetSize userBuffer) { lock (ioLock) { + if (xobileTlsContext == null) + return (0, false); + // This operates on the internal buffer and will never block. if (operation != Operation.Authenticated) throw GetInternalError ();