[Freeswitch-svn] [commit] r8083 - freeswitch/trunk/src/mod/applications/mod_enum

Freeswitch SVN anthm at freeswitch.org
Thu Apr 10 11:42:13 EDT 2008


Author: anthm
Date: Thu Apr 10 11:42:13 2008
New Revision: 8083

Modified:
   freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c

Log:
fix seg in new function

Modified: freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c	Thu Apr 10 11:42:13 2008
@@ -673,6 +673,12 @@
 	switch_size_t l = 0, rbl = sizeof(rbuf);
 	int last_order = -1, last_pref = -2;
 	char *last_delim = "|";
+	int ok = 0;
+	
+	if (switch_strlen_zero(cmd)) {
+		stream->write_function(stream, "%s", "none");
+		return SWITCH_STATUS_SUCCESS;
+	}
 
 	if (!(mydata = strdup(cmd))) {
 		abort();
@@ -701,11 +707,16 @@
 			*(rbuf + strlen(rbuf) - 1) = '\0';
 			stream->write_function(stream, "%s", rbuf);
 			free_results(&results);
+			ok++;
 		}
 	}
 
 	switch_safe_free(mydata);
 
+	if (!ok) {
+		stream->write_function(stream, "%s", "none");
+	}
+
 	return SWITCH_STATUS_SUCCESS;
 }
 



More information about the Freeswitch-svn mailing list