Only assign line and device in handle_transfer_button when we have a subchannel.
authorMichiel van Baak <michiel@vanbaak.info>
Fri, 4 Dec 2009 16:18:57 +0000 (16:18 +0000)
committerMichiel van Baak <michiel@vanbaak.info>
Fri, 4 Dec 2009 16:18:57 +0000 (16:18 +0000)
(closes issue #16040)
Reported by: ebroad

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@233059 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_skinny.c

index 79eb2fb..c7cfb15 100644 (file)
@@ -4544,8 +4544,8 @@ static int handle_hold_button(struct skinny_subchannel *sub)
 
 static int handle_transfer_button(struct skinny_subchannel *sub)
 {
 
 static int handle_transfer_button(struct skinny_subchannel *sub)
 {
-       struct skinny_line *l = sub->parent;
-       struct skinny_device *d = l->device;
+       struct skinny_line *l;
+       struct skinny_device *d;
        struct skinny_subchannel *newsub;
        struct ast_channel *c;
        pthread_t t;
        struct skinny_subchannel *newsub;
        struct ast_channel *c;
        pthread_t t;
@@ -4554,6 +4554,10 @@ static int handle_transfer_button(struct skinny_subchannel *sub)
                ast_verbose("Transfer: No subchannel to transfer\n");
                return -1;
        }
                ast_verbose("Transfer: No subchannel to transfer\n");
                return -1;
        }
+
+       l = sub->parent;
+       d = l->device;
+
        if (!sub->related) {
                /* Another sub has not been created so this must be first XFER press */
                if (!sub->onhold) {
        if (!sub->related) {
                /* Another sub has not been created so this must be first XFER press */
                if (!sub->onhold) {