From e458fa2d5a192cae2c5598a4c37cf8168dd97d54 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 31 Mar 2014 18:37:35 -0500 Subject: [PATCH] allow execute with no args --- src/mod/languages/mod_basic/mod_basic.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mod/languages/mod_basic/mod_basic.c b/src/mod/languages/mod_basic/mod_basic.c index c94271ac49..89795926c6 100644 --- a/src/mod/languages/mod_basic/mod_basic.c +++ b/src/mod/languages/mod_basic/mod_basic.c @@ -77,6 +77,7 @@ static int fun_execute(mb_interpreter_t* s, void** l) fs_data_t *fsdata = (fs_data_t *) mb_get_user_data(s); mb_value_t app; mb_value_t arg; + int null_arg = 0; mb_assert(s && l); @@ -87,11 +88,12 @@ static int fun_execute(mb_interpreter_t* s, void** l) } if ((result = mb_pop_value(s, l, &arg)) != MB_FUNC_OK) { - goto end; + null_arg++; + result = 0; } - if (app.type == MB_DT_STRING && arg.type == MB_DT_STRING && fsdata->session) { - switch_core_session_execute_application(fsdata->session, app.value.string, arg.value.string); + if (app.type == MB_DT_STRING && (arg.type == MB_DT_STRING || null_arg) && fsdata->session) { + switch_core_session_execute_application(fsdata->session, app.value.string, null_arg ? NULL : arg.value.string); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad args or no fsdata->session\n"); result = MB_FUNC_WARNING;