diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 9ccec64..3976e43 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -8316,6 +8316,9 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast) * the same private structure. */ p = ast_channel_tech_pvt(ast); + if (!p) { + return &ast_null_frame; + } while (ast_mutex_trylock(&p->lock)) { CHANNEL_DEADLOCK_AVOIDANCE(ast); @@ -8774,6 +8777,11 @@ static int dahdi_write(struct ast_channel *ast, struct ast_frame *frame) struct dahdi_pvt *p = ast_channel_tech_pvt(ast); int res; int idx; + if (!p) { + ast_log(LOG_WARNING, "%s doesn't really exist? (NULL pvt)\n", + ast_channel_name(ast)); + return -1; + } idx = dahdi_get_index(ast, p, 0); if (idx < 0) { ast_log(LOG_WARNING, "%s doesn't really exist?\n", ast_channel_name(ast));