[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r2583: Don't crash if, for some reason, send() gets called when the (in vidalia: . trunk/src/torcontrol)



Author: edmanm
Date: 2008-05-19 20:08:19 -0400 (Mon, 19 May 2008)
New Revision: 2583

Modified:
   vidalia/
   vidalia/trunk/src/torcontrol/controlconnection.cpp
Log:
 r325@thebe:  edmanm | 2008-05-19 19:51:33 -0400
 Don't crash if, for some reason, send() gets called when the control socket is
 not connected.



Property changes on: vidalia
___________________________________________________________________
 svk:merge ticket from /local/vidalia [r325] on 45a62a8a-8088-484c-baad-c7b3e776dd32

Modified: vidalia/trunk/src/torcontrol/controlconnection.cpp
===================================================================
--- vidalia/trunk/src/torcontrol/controlconnection.cpp	2008-05-19 23:28:26 UTC (rev 2582)
+++ vidalia/trunk/src/torcontrol/controlconnection.cpp	2008-05-20 00:08:19 UTC (rev 2583)
@@ -204,6 +204,10 @@
   QString errstr;
   
   _connMutex.lock();
+  if (!_sock) {
+    _connMutex.unlock();
+    return err(errmsg, tr("Control socket is not connected."));
+  }
   if (_sock->sendCommand(cmd, &errstr)) {
     /* Create and enqueue a new receive waiter */
     _recvQueue.enqueue(&w);
@@ -231,6 +235,8 @@
 ControlConnection::send(const ControlCommand &cmd, QString *errmsg)
 {
   QMutexLocker locker(&_connMutex);
+  if (!_sock)
+    return err(errmsg, tr("Control socket is not connected.")); 
   return _sock->sendCommand(cmd, errmsg);
 }