Skip to content

Commit 623e567

Browse files
committed
Don't use ternary operator for JSON validator check (see #3466)
1 parent b04234c commit 623e567

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/plugins/janus_sip.c

+9-4
Original file line numberDiff line numberDiff line change
@@ -3990,10 +3990,15 @@ static void *janus_sip_handler(void *data) {
39903990
goto error;
39913991
}
39923992
janus_mutex_unlock(&session->mutex);
3993-
struct janus_json_parameter *params = progress ? progress_parameters : accept_parameters;
3994-
JANUS_VALIDATE_JSON_OBJECT(root, params,
3995-
error_code, error_cause, TRUE,
3996-
JANUS_SIP_ERROR_MISSING_ELEMENT, JANUS_SIP_ERROR_INVALID_ELEMENT);
3993+
if(progress) {
3994+
JANUS_VALIDATE_JSON_OBJECT(root, progress_parameters,
3995+
error_code, error_cause, TRUE,
3996+
JANUS_SIP_ERROR_MISSING_ELEMENT, JANUS_SIP_ERROR_INVALID_ELEMENT);
3997+
} else {
3998+
JANUS_VALIDATE_JSON_OBJECT(root, accept_parameters,
3999+
error_code, error_cause, TRUE,
4000+
JANUS_SIP_ERROR_MISSING_ELEMENT, JANUS_SIP_ERROR_INVALID_ELEMENT);
4001+
}
39974002
if(error_code != 0)
39984003
goto error;
39994004
json_t *srtp = json_object_get(root, "srtp");

0 commit comments

Comments
 (0)