diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 3c0a46e2d3..6ebb1b2ec9 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -4231,6 +4231,11 @@ static int sip_setoption(struct ast_channel *chan, int option, void *data, int d int res = -1; struct sip_pvt *p = chan->tech_pvt; + if (!p) { + ast_log(LOG_ERROR, "Attempt to Ref a null pointer. sip private structure is gone!\n"); + return -1; + } + sip_pvt_lock(p); switch (option) {