[telepathy-gabble/master] connection.c: return an error if gabble_send_(with_reply) is called while there is no lmconn

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Sep 11 07:56:18 PDT 2009


---
 src/connection.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/connection.c b/src/connection.c
index f7788a8..3f636b3 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1095,6 +1095,13 @@ _gabble_connection_send (GabbleConnection *conn, LmMessage *msg, GError **error)
 
   g_assert (GABBLE_IS_CONNECTION (conn));
 
+  if (conn->lmconn == NULL)
+    {
+      g_set_error_literal (error, TP_ERRORS, TP_ERROR_NETWORK_ERROR,
+              "connection is disconnected");
+      return FALSE;
+    }
+
   priv = conn->priv;
 
   if (!lm_connection_send (conn->lmconn, msg, &lmerror))
@@ -1208,6 +1215,13 @@ _gabble_connection_send_with_reply (GabbleConnection *conn,
 
   g_assert (GABBLE_IS_CONNECTION (conn));
 
+  if (conn->lmconn == NULL)
+    {
+      g_set_error_literal (error, TP_ERRORS, TP_ERROR_NETWORK_ERROR,
+              "connection is disconnected");
+      return FALSE;
+    }
+
   priv = conn->priv;
 
   lm_message_ref (msg);
-- 
1.5.6.5




More information about the telepathy-commits mailing list