[Freeswitch-svn] [commit] r8509 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Wed May 21 16:32:51 EDT 2008


Author: mikej
Date: Wed May 21 16:32:51 2008
New Revision: 8509

Modified:
   freeswitch/trunk/src/switch_ivr_play_say.c

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

Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c	(original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c	Wed May 21 16:32:51 2008
@@ -735,15 +735,18 @@
             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");



More information about the Freeswitch-svn mailing list