Commit e2e1263e authored by Youness Alaoui's avatar Youness Alaoui

Make the agent_find_component return NULL if you search for a component that...

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..

darcs-hash:20080422193155-4f0f6-dc5a4ad39c7c5124779e1605545da4f5647a79ef.gz
parent f1a115c1
...@@ -133,17 +133,23 @@ agent_find_component ( ...@@ -133,17 +133,23 @@ agent_find_component (
Component **component) Component **component)
{ {
Stream *s; Stream *s;
Component *c;
s = agent_find_stream (agent, stream_id); s = agent_find_stream (agent, stream_id);
if (s == NULL) if (s == NULL)
return FALSE; return FALSE;
c = stream_find_component_by_id (s, component_id);
if (c == NULL)
return FALSE;
if (stream) if (stream)
*stream = s; *stream = s;
if (component) if (component)
*component = stream_find_component_by_id (s, component_id); *component = c;
return TRUE; return TRUE;
} }
...@@ -1441,7 +1447,9 @@ nice_agent_send ( ...@@ -1441,7 +1447,9 @@ nice_agent_send (
g_mutex_lock (agent->mutex); 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) if (component->selected_pair.local != NULL)
{ {
...@@ -1784,8 +1792,7 @@ nice_agent_attach_recv ( ...@@ -1784,8 +1792,7 @@ nice_agent_attach_recv (
/* attach candidates */ /* attach candidates */
/* step: check that params specify an existing pair */ /* step: check that params specify an existing pair */
if (!agent_find_component (agent, stream_id, component_id, if (!agent_find_component (agent, stream_id, component_id, &stream, &component)) {
&stream, &component)) {
goto done; goto done;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment