--- asterisk-issue8824-2009-01-29/channels/chan_local.c 2009-01-29 10:23:30.000000000 +0100 +++ asterisk-issue8824-2009-01-29.new/channels/chan_local.c 2009-08-13 10:25:30.000000000 +0200 @@ -174,23 +174,25 @@ static struct ast_channel *local_bridgedchannel(struct ast_channel *chan, struct ast_channel *bridge) { struct local_pvt *p = bridge->tech_pvt; - struct ast_channel *bridged = bridge; + struct ast_channel *bridged = NULL; - ast_mutex_lock(&p->lock); + if (p) { + bridged = bridge; - if (ast_test_flag(p, LOCAL_BRIDGE)) { - /* Find the opposite channel */ - bridged = (bridge == p->owner ? p->chan : p->owner); + ast_mutex_lock(&p->lock); + if (ast_test_flag(p, LOCAL_BRIDGE)) { + /* Find the opposite channel */ + bridged = (bridge == p->owner ? p->chan : p->owner); - /* Now see if the opposite channel is bridged to anything */ - if (!bridged) { - bridged = bridge; - } else if (bridged->_bridge) { - bridged = bridged->_bridge; + /* Now see if the opposite channel is bridged to anything */ + if (!bridged) { + bridged = bridge; + } else if (bridged->_bridge) { + bridged = bridged->_bridge; + } } - } - - ast_mutex_unlock(&p->lock); + ast_mutex_unlock(&p->lock); + } return bridged; }