handle NULL values better. Found by Klockwork (www.klocwork.com)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8509 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-05-21 20:32:51 +00:00
parent 103dfc02cb
commit a35dddbfc0
1 changed files with 9 additions and 6 deletions

View File

@ -735,15 +735,18 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
dup = switch_core_session_strdup(session, alt);
engine = dup;
if ((voice = strchr(engine, ':'))) {
*voice++ = '\0';
if ((text = strchr(voice, ':'))) {
*text++ = '\0';
if (!switch_strlen_zero(engine)) {
if ((voice = strchr(engine, ':'))) {
*voice++ = '\0';
if (!switch_strlen_zero(voice) && (text = strchr(voice, ':'))) {
*text++ = '\0';
}
}
}
if (engine && voice && text) {
if (!switch_strlen_zero(engine) && !switch_strlen_zero(voice) && !switch_strlen_zero(text)) {
return switch_ivr_speak_text(session, engine, voice, text, args);
} else if (engine && !(voice && text)) {
} else if (!switch_strlen_zero(engine) && !(voice && text)) {
text = engine;
engine = (char *)switch_channel_get_variable(channel, "tts_engine");
voice = (char *)switch_channel_get_variable(channel, "tts_voice");