Fix bug #3139, "Mainwindow unresponsive due to a busy loop"
[claws.git] / src / common / session.c
index c43e5e413e92e40873c16b12b015d5c8bf875ddc..25038c98fb1d3916e492fb0f9b2044130442ce33 100644 (file)
@@ -528,9 +528,10 @@ static gboolean session_read_msg_cb(SockInfo *source, GIOCondition condition,
        session_set_timeout(session, session->timeout_interval);
 
        if (session->read_buf_len == 0) {
-               gint read_len;
+               gint read_len = -1;
 
-               read_len = sock_read(session->sock, session->read_buf,
+               if (session->sock)
+                       read_len = sock_read(session->sock, session->read_buf,
                                     SESSION_BUFFSIZE - 1);
 
                if (read_len == -1 && session->state == SESSION_DISCONNECTED) {