fix crash on zstr

This commit is contained in:
Seven Du 2013-09-27 03:31:21 +08:00
parent 7081f11ab2
commit e09cdf9c3a
1 changed files with 10 additions and 3 deletions

View 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;
}