don't format non numbers

This commit is contained in:
Michael Jerris 2011-11-21 13:31:19 -05:00
parent a24148db71
commit d66d41232b
1 changed files with 14 additions and 3 deletions

View File

@ -2892,11 +2892,23 @@ SWITCH_DECLARE(char *) switch_format_number(const char *num)
char *r;
size_t len;
const char *p = num;
if(*p == '+') {
if (!p) {
return p;
}
if (zstr(p)) {
return strdup(p);
}
if (*p == '+') {
p++;
}
if (!switch_is_number(p)) {
return strdup(p);
}
len = strlen(p);
/* region 1, TBD add more....*/
@ -2907,7 +2919,6 @@ SWITCH_DECLARE(char *) switch_format_number(const char *num)
} else {
r = strdup(num);
}
return r;
}