diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-10-18 16:51:28 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-10-18 16:51:28 +0000 |
commit | 4bb982a9a1daeda4cfe182194d2f8b40a33f7776 (patch) | |
tree | 971d80f9f8287e3972b74a998f1526674e196750 /pbx.c | |
parent | 03ab01988899db3b0ca5b9342461f4040d384da1 (diff) |
Fix truth of strings
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6817 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rwxr-xr-x | pbx.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -6029,7 +6029,21 @@ void pbx_builtin_clear_globals(void) static int pbx_checkcondition(char *condition) { - return condition ? atoi(condition) : 0; + if (condition) { + if (*condition == '\0') { + /* Empty strings are false */ + return 0; + } else if (*condition >= '0' && *condition <= '9') { + /* Numbers are evaluated for truth */ + return atoi(condition); + } else { + /* Strings are true */ + return 1; + } + } else { + /* NULL is also false */ + return 0; + } } static int pbx_builtin_gotoif(struct ast_channel *chan, void *data) |