diff --git a/Pop3Client.cs b/Pop3Client.cs index 97a5c05..3909068 100644 --- a/Pop3Client.cs +++ b/Pop3Client.cs @@ -15,7 +15,10 @@ internal override void OnLogin(string username, string password) { } internal override void OnLogout() { - SendCommand("QUIT"); + if (_Stream != null) + { + SendCommand("QUIT"); + } } internal override void CheckResultOK(string result) { diff --git a/TextClient.cs b/TextClient.cs index 5688c36..8d1af8e 100644 --- a/TextClient.cs +++ b/TextClient.cs @@ -122,7 +122,7 @@ public void Disconnect() { _Stream.Dispose(); _Stream = null; } - if (!_ReadThread.Join(2000)) { + if (_ReadThread != null && !_ReadThread.Join(2000)) { _ReadThread.Abort(); } }