From a35dddbfc06774f5d0adaa82de2715e2dc642798 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 21 May 2008 20:32:51 +0000 Subject: [PATCH] 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 --- src/switch_ivr_play_say.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 000ae7e1c9..7448b23c49 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -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");