Index: channel.c =================================================================== RCS file: /usr/cvsroot/asterisk/channel.c,v retrieving revision 1.70 diff -u -r1.70 channel.c --- channel.c 7 Nov 2003 03:48:03 -0000 1.70 +++ channel.c 5 Dec 2003 20:03:28 -0000 @@ -356,12 +356,24 @@ struct ast_frame *prev, *cur; int blah = 1; int qlen = 0; + + if (!chan) { + ast_log(LOG_ERROR, "NULL chan"); + return -1; + } + if (!chan->pvt) { + ast_log(LOG_ERROR, "NULL chan->pvt for %s", chan->name); + return -1; + } + /* Build us a copy and free the original one */ f = ast_frdup(fin); if (!f) { ast_log(LOG_WARNING, "Unable to duplicate frame\n"); return -1; } + + if (lock) ast_mutex_lock(&chan->lock); prev = NULL;