only check for an existing cdr when about to set an arbitrary cdr variable (bug ...
authorRussell Bryant <russell@russellbryant.com>
Wed, 3 Aug 2005 21:34:48 +0000 (21:34 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 3 Aug 2005 21:34:48 +0000 (21:34 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6277 65c4cc65-6c06-0410-ace0-fbb531ad65f3

funcs/func_cdr.c

index 1220a82..1a6dc07 100755 (executable)
@@ -64,9 +64,6 @@ static void builtin_function_cdr_write(struct ast_channel *chan, char *cmd, char
        if (!data || ast_strlen_zero(data) || !value)
                return;
        
        if (!data || ast_strlen_zero(data) || !value)
                return;
        
-       if (!chan->cdr)
-               return;
-
        mydata = ast_strdupa(data);
        argc = ast_separate_app_args(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]));
 
        mydata = ast_strdupa(data);
        argc = ast_separate_app_args(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]));
 
@@ -81,7 +78,7 @@ static void builtin_function_cdr_write(struct ast_channel *chan, char *cmd, char
                ast_cdr_setaccount(chan, value);
        else if (!strcasecmp(argv[0], "userfield"))
                ast_cdr_setuserfield(chan, value);
                ast_cdr_setaccount(chan, value);
        else if (!strcasecmp(argv[0], "userfield"))
                ast_cdr_setuserfield(chan, value);
-       else
+       else if (chan->cdr)
                ast_cdr_setvar(chan->cdr, argv[0], value, recursive);
 }
 
                ast_cdr_setvar(chan->cdr, argv[0], value, recursive);
 }