<p>Sean Bright has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/17590">View Change</a></p><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;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/90/17590/1</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 8505b1d..de5e39f 100644</span><br><span>--- a/main/channel.c</span><br><span>+++ b/main/channel.c</span><br><span>@@ -1449,17 +1449,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><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/17590">change 17590</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/+/17590"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I88eadc748e9c6996fc17467b0a05881bbfd00bce </div>
<div style="display:none"> Gerrit-Change-Number: 17590 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean@seanbright.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>