From e78d668234a9fa9551b9d2300660ed23cc26389c Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthony.minessale@gmail.com>
Date: Fri, 6 Jan 2006 23:01:28 +0000
Subject: [PATCH] update

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@302 d0543943-73ff-0310-b7d9-9358b9ac24b2
---
 src/mod/endpoints/mod_iaxchan/mod_iaxchan.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/mod/endpoints/mod_iaxchan/mod_iaxchan.c b/src/mod/endpoints/mod_iaxchan/mod_iaxchan.c
index c106502f5a..b86a62598f 100644
--- a/src/mod/endpoints/mod_iaxchan/mod_iaxchan.c
+++ b/src/mod/endpoints/mod_iaxchan/mod_iaxchan.c
@@ -423,8 +423,13 @@ static switch_status channel_on_hangup(switch_core_session *session)
 	switch_clear_flag(tech_pvt, TFLAG_IO);
 	switch_thread_cond_signal(tech_pvt->cond);
 
-	switch_core_codec_destroy(&tech_pvt->read_codec);
-	switch_core_codec_destroy(&tech_pvt->write_codec);
+	if (tech_pvt->read_codec.implementation) {
+		switch_core_codec_destroy(&tech_pvt->read_codec);
+	}
+
+	if (tech_pvt->write_codec.implementation) {
+		switch_core_codec_destroy(&tech_pvt->write_codec);
+	}
 
 	if (tech_pvt->iax_session) {
 		if (!switch_test_flag(tech_pvt, TFLAG_HANGUP)) {