]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
handle NULL values better. Found by Klockwork (www.klocwork.com)
authorMichael Jerris <mike@jerris.com>
Wed, 21 May 2008 20:32:51 +0000 (20:32 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 21 May 2008 20:32:51 +0000 (20:32 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8509 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_play_say.c

index 000ae7e1c9d0d14323c31c548440e244583782ca..7448b23c4951bbb8abba69ed7a28029fdc7e3209 100644 (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");