[Nice] [nice/master] Make the agent_find_component return NULL if you search for a component that doesn't exist (but the stream exists). also check the return value of agent_find_component from one call that didn't..

Youness Alaoui youness.alaoui at collabora.co.uk
Wed Nov 5 14:01:00 PST 2008


darcs-hash:20080422193155-4f0f6-dc5a4ad39c7c5124779e1605545da4f5647a79ef.gz
---
 agent/agent.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/agent/agent.c b/agent/agent.c
index 43beaad..43b344a 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -133,17 +133,23 @@ agent_find_component (
   Component **component)
 {
   Stream *s;
+  Component *c;
 
   s = agent_find_stream (agent, stream_id);
 
   if (s == NULL)
     return FALSE;
 
+  c = stream_find_component_by_id (s, component_id);
+
+  if (c == NULL)
+    return FALSE;
+
   if (stream)
     *stream = s;
 
   if (component)
-    *component = stream_find_component_by_id (s, component_id);
+    *component = c;
 
   return TRUE;
 }
@@ -1441,7 +1447,9 @@ nice_agent_send (
 
   g_mutex_lock (agent->mutex);
 
-  agent_find_component (agent, stream_id, component_id, &stream, &component);
+  if (!agent_find_component (agent, stream_id, component_id, &stream, &component)) {
+    goto done;
+  }
 
   if (component->selected_pair.local != NULL)
     {
@@ -1784,8 +1792,7 @@ nice_agent_attach_recv (
   /* attach candidates */
 
   /* step: check that params specify an existing pair */
-  if (!agent_find_component (agent, stream_id, component_id,
-          &stream, &component)) {
+  if (!agent_find_component (agent, stream_id, component_id, &stream, &component)) {
     goto done;
   }
 
-- 
1.5.6.5




More information about the Nice mailing list