]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7378 play_and_detect_speech: protect against NULL result
authorChris Rienzo <chris.rienzo@grasshopper.com>
Wed, 18 Mar 2015 19:30:12 +0000 (15:30 -0400)
committerChris Rienzo <chris.rienzo@grasshopper.com>
Wed, 18 Mar 2015 19:30:12 +0000 (15:30 -0400)
src/mod/applications/mod_dptools/mod_dptools.c
src/switch_ivr_async.c

index d7eb90b41794fee83dd10c18f080de819e3a7c86..c3b96daf24c9aab389d4033eaa13c28dd2d75c8a 100644 (file)
@@ -515,7 +515,9 @@ SWITCH_STANDARD_APP(play_and_detect_speech_function)
                char *grammar = argv[1];
                char *result = NULL;
                switch_ivr_play_and_detect_speech(session, file, engine, grammar, &result, 0, NULL);
-               switch_channel_set_variable(channel, "detect_speech_result", result);
+               if (!zstr(result)) {
+                       switch_channel_set_variable(channel, "detect_speech_result", result);
+               }
        } else {
                /* bad input */
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", PLAY_AND_DETECT_SPEECH_SYNTAX);
index c7fb1e3c0ebbd43354508b57f42b75626aa832f4..e7f05ac9ff5b3d3e2cc73cc1b8acb06bc3fc4f71 100644 (file)
@@ -3928,7 +3928,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_se
        switch_status_t status = SWITCH_STATUS_SUCCESS;
        int recognizing = 0;
        switch_input_args_t myargs = { 0 };
-       play_and_detect_speech_state_t state = { 0 };
+       play_and_detect_speech_state_t state = { 0, "" };
        switch_channel_t *channel = switch_core_session_get_channel(session);
 
        arg_recursion_check_start(args);