diff --git a/channels/chan_zap.c b/channels/chan_zap.c index f401b85e271e5f04ab22d7c3259e7cbe86b35f27..93b01d405ca02bff4db86f6569b2dbaa82f6df5c 100644 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -5744,6 +5744,15 @@ static void *ss_thread(void *data) int res; int index; + /* in the bizarre case where the channel has become a zombie before we + even get started here, abort safely + */ + if (!p) { + ast_log(LOG_WARNING, "Channel became a zombie before simple switch could be started (%s)\n", chan->name); + ast_hangup(chan); + return NULL; + } + if (option_verbose > 2) ast_verbose( VERBOSE_PREFIX_3 "Starting simple switch on '%s'\n", chan->name); index = zt_get_index(chan, p, 1);