main/stasis_channels.c: Fix crash when setting a global variable with invalid UTF8 characters

Add check for null value of chan before referencing it with ast_channel_name()

Resolves: #999
(cherry picked from commit 3e31489415)
releases/20
James Terhune 5 months ago committed by Asterisk Development Team
parent 2d2d17811a
commit 891e60e22e

@ -1185,7 +1185,7 @@ void ast_channel_publish_varset(struct ast_channel *chan, const char *name, cons
value, strlen(value));
ast_log(LOG_WARNING, "%s: The contents of variable '%s' had invalid UTF-8 sequences which were replaced",
ast_channel_name(chan), name);
chan ? ast_channel_name(chan) : "GLOBAL", name);
}
blob = ast_json_pack("{s: s, s: s}",

Loading…
Cancel
Save