Commit 778c99c8 authored by Philip Withnall's avatar Philip Withnall
Browse files

agent: Add some preconditions to public API

To try and avoid NULL NiceCandidates entering our internal state.
parent 685cf0b4
......@@ -5024,6 +5024,11 @@ nice_agent_set_selected_remote_candidate (
NiceCandidate *local = NULL, *remote = NULL;
guint64 priority;
g_return_val_if_fail (NICE_IS_AGENT (agent), FALSE);
g_return_val_if_fail (stream_id != 0, FALSE);
g_return_val_if_fail (component_id != 0, FALSE);
g_return_val_if_fail (candidate != NULL, FALSE);
/* step: check if the component exists*/
......@@ -305,8 +305,11 @@ nice_candidate_pair_priority (guint32 o_prio, guint32 a_prio)
NICEAPI_EXPORT NiceCandidate *
nice_candidate_copy (const NiceCandidate *candidate)
NiceCandidate *copy = nice_candidate_new (candidate->type);
NiceCandidate *copy;
g_return_val_if_fail (candidate != NULL, NULL);
copy = nice_candidate_new (candidate->type);
memcpy (copy, candidate, sizeof(NiceCandidate));
copy->turn = NULL;
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