]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix segfault thanks bblack
authorBrian West <brian@freeswitch.org>
Sun, 8 Apr 2007 03:53:35 +0000 (03:53 +0000)
committerBrian West <brian@freeswitch.org>
Sun, 8 Apr 2007 03:53:35 +0000 (03:53 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4889 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_commands/mod_commands.c

index 80a9c7c5427aa393fcd7adc32cb1e85d83947b62..411e9a96ddd6ee44c0db3e8cdeb02d37d1cdd661 100644 (file)
@@ -27,6 +27,7 @@
  * Michael Jerris <mike@jerris.com>
  * Johny Kadarisman <jkr888@gmail.com>
  * Paul Tinsley <jackhammer@gmail.com>
+ * Marcel Barbulescu <marcelbarbulescu@gmail.com>
  *
  * 
  * mod_commands.c -- Misc. Command Module
@@ -901,19 +902,21 @@ static switch_status_t show_function(char *data, switch_core_session_t *session,
        int help = 0;
        char *mydata, *argv[5] = {0};
        int argc;
-       char *cmd, *as = NULL;
+       char *cmd = NULL, *as = NULL;
 
        if (session) {
                return SWITCH_STATUS_FALSE;
        }
 
-       if ((mydata = strdup(data))) {
-               argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-       }       
+       if (data) {
+               if ((mydata = strdup(data))) {
+                       argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+               }       
 
-       cmd = argv[0];
-       if (argv[2] && !strcasecmp(argv[1], "as")) {
-               as = argv[2];
+               cmd = argv[0];
+               if (argv[2] && !strcasecmp(argv[1], "as")) {
+                       as = argv[2];
+               }
        }
        
        if (!as && stream->event) {