From db534bd8f078e00e8bbdfd839c58cfb778864e2e Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 28 Feb 2008 17:23:10 +0000 Subject: [PATCH] handle invalid disconnect with no matching zchan git-svn-id: http://svn.openzap.org/svn/openzap/trunk@415 a93c3328-9c30-0410-af19-c9cd2b2d52af --- libs/openzap/src/zap_isdn.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libs/openzap/src/zap_isdn.c b/libs/openzap/src/zap_isdn.c index 31e17049d7..39c904b329 100644 --- a/libs/openzap/src/zap_isdn.c +++ b/libs/openzap/src/zap_isdn.c @@ -169,10 +169,13 @@ static L3INT zap_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) break; case Q931mes_DISCONNECT: { - Q931ie_Cause *cause = Q931GetIEPtr(gen->Cause, gen->buf); - zchan->caller_data.hangup_cause = cause->Value; - zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_TERMINATING); - + if (zchan) { + Q931ie_Cause *cause = Q931GetIEPtr(gen->Cause, gen->buf); + zchan->caller_data.hangup_cause = cause->Value; + zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_TERMINATING); + } else { + zap_log(ZAP_LOG_CRIT, "Received Diconnect with no matching channel %d\n", chan_id); + } } break; case Q931mes_ALERTING: