]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 66537 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Tue, 29 May 2007 21:56:07 +0000 (21:56 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Tue, 29 May 2007 21:56:07 +0000 (21:56 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r66537 | tilghman | 2007-05-29 16:49:35 -0500 (Tue, 29 May 2007) | 2 lines

If the value of a variable passed to FIELDQTY is blank, then FIELDQTY should return 0, not 1.

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@66538 65c4cc65-6c06-0410-ace0-fbb531ad65f3

funcs/func_strings.c

index e1808604be18252cab9095444b3dd14503838b07..3c8ead803127288a144e701d087b645f7f9b97a0 100644 (file)
@@ -59,8 +59,12 @@ static int function_fieldqty(struct ast_channel *chan, char *cmd,
 
                sprintf(varsubst, "${%s}", args.varname);
                pbx_substitute_variables_helper(chan, varsubst, varval, sizeof(varval) - 1);
-               while (strsep(&varval2, args.delim))
-                       fieldcount++;
+               if (ast_strlen_zero(varval2))
+                       fieldcount = 0;
+               else {
+                       while (strsep(&varval2, args.delim))
+                               fieldcount++;
+               }
        } else {
                fieldcount = 1;
        }