aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_directed_pickup.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-12-20 09:56:55 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-12-20 09:56:55 +0000
commitb5a869b53c73c2f7c09dcafdca333915b0cab279 (patch)
treec63db32285cf58b7d52ffec7b9dea34c57056dde /apps/app_directed_pickup.c
parentfe070f491c4519b14325bfedaa864141386f8844 (diff)
Fix segfault on directed pickup when no CDR is available (bug #5998)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7541 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_directed_pickup.c')
-rw-r--r--apps/app_directed_pickup.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c
index 7008ff083..9e7d3cc84 100644
--- a/apps/app_directed_pickup.c
+++ b/apps/app_directed_pickup.c
@@ -77,7 +77,7 @@ static int pickup_exec(struct ast_channel *chan, void *data)
/* Find a channel to pickup */
origin = ast_get_channel_by_exten_locked(exten, context);
- if (origin) {
+ if (origin && origin->cdr) {
ast_cdr_getvar(origin->cdr, "dstchannel", &tmp, workspace,
sizeof(workspace), 0);
if (tmp) {
@@ -89,6 +89,8 @@ static int pickup_exec(struct ast_channel *chan, void *data)
}
ast_mutex_unlock(&origin->lock);
} else {
+ if (origin)
+ ast_mutex_unlock(&origin->lock);
ast_log(LOG_DEBUG, "No originating channel found.\n");
}