diff options
Diffstat (limited to 'main/cdr.c')
-rw-r--r-- | main/cdr.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/main/cdr.c b/main/cdr.c index f0ba2ea2e..18d53b2a3 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -581,7 +581,9 @@ void ast_cdr_merge(struct ast_cdr *to, struct ast_cdr *from) lfrom = lfrom->next; } /* rip off the last entry and put a copy of the to at the end */ - llfrom->next = to; + if (llfrom) { + llfrom->next = to; + } from = lfrom; } else { /* save copy of the current *to cdr */ @@ -597,10 +599,11 @@ void ast_cdr_merge(struct ast_cdr *to, struct ast_cdr *from) } from->next = NULL; /* rip off the last entry and put a copy of the to at the end */ - if (llfrom == from) + if (llfrom == from) { to = to->next = ast_cdr_dup(&tcdr); - else + } else if (llfrom) { to = llfrom->next = ast_cdr_dup(&tcdr); + } from = lfrom; } } |