[Asterisk-code-review] res_musiconhold: Avoid spurious warning when 'format' is the empty st... (asterisk[16])

Sean Bright asteriskteam at digium.com
Tue Feb 11 07:56:18 CST 2020


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/13801 )


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, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/01/13801/1

diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 1bacb11..dd9b8a5 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -1119,7 +1119,7 @@
 			} else if (!strcasecmp(var->value, "randstart")) {
 				ast_set_flag(mohclass, MOH_RANDSTART);
 			}
-		} else if (!strcasecmp(var->name, "format")) {
+		} else if (!strcasecmp(var->name, "format") && !ast_strlen_zero(var->value)) {
 			ao2_cleanup(mohclass->format);
 			mohclass->format = ast_format_cache_get(var->value);
 			if (!mohclass->format) {

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13801
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I9a271d721e1a0973e80ebe7d75b46a0d8fa0e5a5
Gerrit-Change-Number: 13801
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200211/7b46196e/attachment.html>


More information about the asterisk-code-review mailing list