aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/pop3/POP3Connection.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2013-08-16 09:41:25 +0000
committerVincent Richard <[email protected]>2013-08-16 09:41:25 +0000
commit757f8a7dc706b83e969309d44bc04dc38785d157 (patch)
tree466de92acc2322be2ccbbfea90d744811f0e5101 /src/net/pop3/POP3Connection.cpp
parentFixed isEmpty() test. (diff)
downloadvmime-757f8a7dc706b83e969309d44bc04dc38785d157.tar.gz
vmime-757f8a7dc706b83e969309d44bc04dc38785d157.zip
Fixed segfault at POP3 connection error.
Diffstat (limited to 'src/net/pop3/POP3Connection.cpp')
-rw-r--r--src/net/pop3/POP3Connection.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/net/pop3/POP3Connection.cpp b/src/net/pop3/POP3Connection.cpp
index 33349749..948242d7 100644
--- a/src/net/pop3/POP3Connection.cpp
+++ b/src/net/pop3/POP3Connection.cpp
@@ -188,18 +188,25 @@ void POP3Connection::disconnect()
void POP3Connection::internalDisconnect()
{
- try
- {
- POP3Command::QUIT()->send(thisRef().dynamicCast <POP3Connection>());
- POP3Response::readResponse(thisRef().dynamicCast <POP3Connection>());
- }
- catch (exception&)
+ if (m_socket)
{
- // Not important
- }
+ if (m_socket->isConnected())
+ {
+ try
+ {
+ POP3Command::QUIT()->send(thisRef().dynamicCast <POP3Connection>());
+ POP3Response::readResponse(thisRef().dynamicCast <POP3Connection>());
+ }
+ catch (exception&)
+ {
+ // Not important
+ }
- m_socket->disconnect();
- m_socket = NULL;
+ m_socket->disconnect();
+ }
+
+ m_socket = NULL;
+ }
m_timeoutHandler = NULL;