]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix crash on zstr
authorSeven Du <dujinfang@gmail.com>
Thu, 26 Sep 2013 19:31:21 +0000 (03:31 +0800)
committerSeven Du <dujinfang@gmail.com>
Thu, 26 Sep 2013 19:31:21 +0000 (03:31 +0800)
src/mod/applications/mod_sonar/mod_sonar.c

index 4453deea90dc1919f4ce1fb60a19864f58bc052d..5a1074e08d63e9bd18cd9425e435aa3623d530d8 100644 (file)
@@ -70,9 +70,16 @@ SWITCH_STANDARD_APP(sonar_app)
 {
        switch_channel_t *channel = switch_core_session_get_channel(session);
        char *tone = "%(500,0,1004)";
-       int loops = atoi(data);
-       
-       if ( ! loops ) {
+       const char *arg = (char *) data;
+       int loops;
+
+       if (zstr(arg)) {
+               loops = 5;
+       } else {
+               loops = atoi(data);
+       }
+
+       if (loops < 0) {
                loops = 5;
        }