]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix seg in new function
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 10 Apr 2008 15:42:13 +0000 (15:42 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 10 Apr 2008 15:42:13 +0000 (15:42 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8083 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_enum/mod_enum.c

index ed4e78613726071696b3fd9f592bcd424f7dcb70..8a055df81a535d9d6e0179f5f6f65fab3195bf07 100644 (file)
@@ -673,6 +673,12 @@ SWITCH_STANDARD_API(enum_api)
        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 @@ SWITCH_STANDARD_API(enum_api)
                        *(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;
 }