<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/17616">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">channel: Short-circuit ast_channel_get_by_name() on empty arg.<br><br>We know that passing a NULL or empty argument to<br>ast_channel_get_by_name() will never result in a matching channel and<br>will always result in an error being emitted, so just short-circuit<br>out in that case.<br><br>ASTERISK-28219 #close<br><br>Change-Id: I88eadc748e9c6996fc17467b0a05881bbfd00bce<br>---<br>M main/channel.c<br>1 file changed, 5 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/channel.c b/main/channel.c</span><br><span>index 546f4f8..36afb7f 100644</span><br><span>--- a/main/channel.c</span><br><span>+++ b/main/channel.c</span><br><span>@@ -1426,17 +1426,17 @@</span><br><span> struct ast_channel *chan;</span><br><span> char *l_name = (char *) name;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_strlen_zero(l_name)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* We didn't have a name to search for so quit. */</span><br><span style="color: hsl(120, 100%, 40%);">+ return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> chan = ast_channel_callback(ast_channel_by_name_cb, l_name, &name_len,</span><br><span> (name_len == 0) /* optimize if it is a complete name match */ ? OBJ_KEY : 0);</span><br><span> if (chan) {</span><br><span> return chan;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (ast_strlen_zero(l_name)) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* We didn't have a name to search for so quit. */</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /* Now try a search for uniqueid. */</span><br><span> return ast_channel_callback(ast_channel_by_uniqueid_cb, l_name, &name_len, 0);</span><br><span> }</span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/17616">change 17616</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/17616"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: I88eadc748e9c6996fc17467b0a05881bbfd00bce </div>
<div style="display:none"> Gerrit-Change-Number: 17616 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean@seanbright.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>