[Telepathy-commits] [telepathy-glib/master] tp_connection_hold_handles: add more checks, and do not allow holding 0 handles

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Oct 7 09:19:06 PDT 2008


---
 telepathy-glib/connection-handles.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/telepathy-glib/connection-handles.c b/telepathy-glib/connection-handles.c
index 11cda57..2909bba 100644
--- a/telepathy-glib/connection-handles.c
+++ b/telepathy-glib/connection-handles.c
@@ -452,7 +452,7 @@ connection_held_handles (TpConnection *self,
  * @self: a connection
  * @timeout_ms: the timeout in milliseconds, or -1 to use the default
  * @handle_type: the handle type
- * @n_handles: the number of handles in @handles
+ * @n_handles: the number of handles in @handles (must be at least 1)
  * @handles: an array of handles
  * @callback: called on success or failure (unless @weak_object has become
  *  unreferenced)
@@ -481,6 +481,12 @@ tp_connection_hold_handles (TpConnection *self,
 {
   HoldHandlesContext *context;
 
+  g_return_if_fail (TP_IS_CONNECTION (self));
+  g_return_if_fail (handle_type > TP_HANDLE_TYPE_NONE);
+  g_return_if_fail (handle_type < NUM_TP_HANDLE_TYPES);
+  g_return_if_fail (n_handles >= 1);
+  g_return_if_fail (callback != NULL);
+
   context = g_slice_new0 (HoldHandlesContext);
   context->handle_type = handle_type;
   context->user_data = user_data;
-- 
1.5.6.5




More information about the Telepathy-commits mailing list