<p>George Joseph <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15245">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Sean Bright: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_musiconhold: Don't crash when real-time doesn't return any entries<br><br>ASTERISK-29211 #close<br><br>Change-Id: Ifbf0a4f786ab2a52342f9d1a1db4c9907f069877<br>---<br>M res/res_musiconhold.c<br>1 file changed, 11 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c</span><br><span>index db7dde7..8ac3b92 100644</span><br><span>--- a/res/res_musiconhold.c</span><br><span>+++ b/res/res_musiconhold.c</span><br><span>@@ -1613,18 +1613,21 @@</span><br><span>                  char *category = NULL;</span><br><span>                       size_t entry_count = 0;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-                     while ((category = ast_category_browse(entries, category))) {</span><br><span style="color: hsl(0, 100%, 40%);">-                           const char *entry = ast_variable_retrieve(entries, category, "entry");</span><br><span style="color: hsl(120, 100%, 40%);">+                      /* entries is NULL if there are no results */</span><br><span style="color: hsl(120, 100%, 40%);">+                 if (entries) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                while ((category = ast_category_browse(entries, category))) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                 const char *entry = ast_variable_retrieve(entries, category, "entry");</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-                            if (entry) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                    struct ast_variable *dup = ast_variable_new("entry", entry, "");</span><br><span style="color: hsl(0, 100%, 40%);">-                                    if (dup) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                              entry_count++;</span><br><span style="color: hsl(0, 100%, 40%);">-                                          ast_variable_list_append(&var, dup);</span><br><span style="color: hsl(120, 100%, 40%);">+                                      if (entry) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                          struct ast_variable *dup = ast_variable_new("entry", entry, "");</span><br><span style="color: hsl(120, 100%, 40%);">+                                          if (dup) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                                    entry_count++;</span><br><span style="color: hsl(120, 100%, 40%);">+                                                        ast_variable_list_append(&var, dup);</span><br><span style="color: hsl(120, 100%, 40%);">+                                              }</span><br><span>                                    }</span><br><span>                            }</span><br><span style="color: hsl(120, 100%, 40%);">+                             ast_config_destroy(entries);</span><br><span>                         }</span><br><span style="color: hsl(0, 100%, 40%);">-                       ast_config_destroy(entries);</span><br><span> </span><br><span>                     if (entry_count == 0) {</span><br><span>                              /* Behave as though this class doesn't exist */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15245">change 15245</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/+/15245"/><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: Ifbf0a4f786ab2a52342f9d1a1db4c9907f069877 </div>
<div style="display:none"> Gerrit-Change-Number: 15245 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.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: Nathan Bruning <nathan@iperity.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>