From 1ed290e9304a687df1519c67c0a1fb868691db58 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Thu, 8 Jan 2015 11:38:53 +0800 Subject: [PATCH] follow commit 0bec209a, we should still allow NULL arg --- src/mod/endpoints/mod_verto/mod_verto.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 55411371c6..08f4a5095c 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3583,15 +3583,14 @@ static switch_bool_t jsapi_func(const char *method, cJSON *params, jsock_t *jsoc if (jsock->allowed_fsapi && !strcmp(function, "fsapi")) { cJSON *data = cJSON_GetObjectItem(params, "data"); - cJSON *cmd; - cJSON *arg; + if (data) { + cJSON *cmd = cJSON_GetObjectItem(data, "cmd"); + cJSON *arg = cJSON_GetObjectItem(data, "arg"); - if (data && - (cmd = cJSON_GetObjectItem(data, "cmd")) && - (arg = cJSON_GetObjectItem(data, "arg")) && - cmd->type == cJSON_String && cmd->valuestring && - !auth_api_command(jsock, cmd->valuestring, arg ? arg->valuestring : NULL)) { - return SWITCH_FALSE; + if (cmd && cmd->type == cJSON_String && cmd->valuestring && + !auth_api_command(jsock, cmd->valuestring, arg ? arg->valuestring : NULL)) { + return SWITCH_FALSE; + } } } }