[telepathy-gabble/master] lm-connection: assert than connection and porter are not NULL when sending messages

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


---
 lib/loudmouth/lm-connection.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/lib/loudmouth/lm-connection.c b/lib/loudmouth/lm-connection.c
index b301eb4..667229d 100644
--- a/lib/loudmouth/lm-connection.c
+++ b/lib/loudmouth/lm-connection.c
@@ -134,7 +134,10 @@ lm_connection_unref (LmConnection *connection)
   connection->iq_reply_cancellable = NULL;
 
   if (connection->porter != NULL)
-    g_object_unref (connection->porter);
+    {
+      g_object_unref (connection->porter);
+      connection->porter = NULL;
+    }
 
   g_free (connection);
 }
@@ -144,6 +147,9 @@ lm_connection_send (LmConnection *connection,
     LmMessage *message,
     GError **error)
 {
+  g_assert (connection != NULL);
+  g_assert (connection->porter != NULL);
+
   wocky_porter_send (connection->porter, message);
   return TRUE;
 }
@@ -178,6 +184,9 @@ lm_connection_send_with_reply (LmConnection *connection,
     LmMessageHandler *handler,
     GError **error)
 {
+  g_assert (connection != NULL);
+  g_assert (connection->porter != NULL);
+
   handler->connection = connection;
   lm_message_handler_ref (handler);
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list