From b7b080a0aa6da8c3b370824d73d6815adfdf266f Mon Sep 17 00:00:00 2001
From: Joshua Colp <jcolp@digium.com>
Date: Wed, 2 Jan 2019 17:33:58 +0000
Subject: [PATCH] app_queue: Fix crash when using 'b' option on non-ringall
 queue.

When using the 'b' option to Queue with a queue that was not configured
for ring all a crash would occur as the wrong pointer would be used.

ASTERISK-28218

Change-Id: If1390f64e321047dff24fd2410c95dde74904980
---
 apps/app_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apps/app_queue.c b/apps/app_queue.c
index 264b54fe54..60be3059b8 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4667,7 +4667,7 @@ static int ring_one(struct queue_ent *qe, struct callattempt *outgoing, int *bus
 			/* Ring just the best channel */
 			ast_debug(1, "Trying '%s' with metric %d\n", best->interface, best->metric);
 			ret = ring_entry(qe, best, busies);
-			if (qe->predial_callee && cur->chan) {
+			if (qe->predial_callee && best->chan) {
 				ast_autoservice_start(best->chan);
 			}
 		}
-- 
GitLab