Don't call release if we have no generator
authorMark Spencer <markster@digium.com>
Wed, 4 Feb 2004 23:18:16 +0000 (23:18 +0000)
committerMark Spencer <markster@digium.com>
Wed, 4 Feb 2004 23:18:16 +0000 (23:18 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2129 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channel.c

index ee971f8..0de79cd 100755 (executable)
--- a/channel.c
+++ b/channel.c
@@ -733,7 +733,8 @@ int ast_answer(struct ast_channel *chan)
 void ast_deactivate_generator(struct ast_channel *chan)
 {
        if (chan->generatordata) {
-               chan->generator->release(chan, chan->generatordata);
+               if (chan->generator && chan->generator->release) 
+                       chan->generator->release(chan, chan->generatordata);
                chan->generatordata = NULL;
                chan->generator = NULL;
                chan->writeinterrupt = 0;
@@ -743,7 +744,8 @@ void ast_deactivate_generator(struct ast_channel *chan)
 int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen, void *params)
 {
        if (chan->generatordata) {
-               chan->generator->release(chan, chan->generatordata);
+               if (chan->generator && chan->generator->release)
+                       chan->generator->release(chan, chan->generatordata);
                chan->generatordata = NULL;
        }
        ast_prod(chan);