[Asterisk-code-review] res_musiconhold: Avoid spurious warning when 'format' is the empty st... (asterisk[13])
Joshua Colp
asteriskteam at digium.com
Thu Feb 13 19:01:00 CST 2020
Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/13740 )
Change subject: res_musiconhold: Avoid spurious warning when 'format' is the empty string
......................................................................
res_musiconhold: Avoid spurious warning when 'format' is the empty string
The change to res_config_odbc that allowed empty strings to be
returned to realtime consumers¹ causes a warning to be emitted when
loading MoH classes. So we need to treat an empty 'format' as if it
was not specified to avoid the warning.
ASTERISK-28735 #close
Reported by: Ross Beer
[1] https://gerrit.asterisk.org/c/asterisk/+/13722
Change-Id: I9a271d721e1a0973e80ebe7d75b46a0d8fa0e5a5
---
M res/res_musiconhold.c
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
George Joseph: Looks good to me, but someone else must approve
Benjamin Keith Ford: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved
Joshua Colp: Approved for Submit
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index f029b16..60682fb 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -1517,7 +1517,7 @@
ast_set_flag(mohclass, MOH_RANDOMIZE);
else if (!strcasecmp(tmp->name, "sort") && !strcasecmp(tmp->value, "alpha"))
ast_set_flag(mohclass, MOH_SORTALPHA);
- else if (!strcasecmp(tmp->name, "format")) {
+ else if (!strcasecmp(tmp->name, "format") && !ast_strlen_zero(tmp->value)) {
ao2_cleanup(mohclass->format);
mohclass->format = ast_format_cache_get(tmp->value);
if (!mohclass->format) {
@@ -1831,7 +1831,7 @@
ast_set_flag(class, MOH_RANDOMIZE);
} else if (!strcasecmp(var->name, "sort") && !strcasecmp(var->value, "alpha")) {
ast_set_flag(class, MOH_SORTALPHA);
- } else if (!strcasecmp(var->name, "format")) {
+ } else if (!strcasecmp(var->name, "format") && !ast_strlen_zero(var->value)) {
ao2_cleanup(class->format);
class->format = ast_format_cache_get(var->value);
if (!class->format) {
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13740
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I9a271d721e1a0973e80ebe7d75b46a0d8fa0e5a5
Gerrit-Change-Number: 13740
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200213/ab732918/attachment.html>
More information about the asterisk-code-review
mailing list