diff options
author | Sungtae Kim <pchero21@gmail.com> | 2018-01-25 02:58:22 +0100 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2018-02-01 17:24:14 -0600 |
commit | 7e32adf044687a0485609baf21e0659c34acd612 (patch) | |
tree | bdbe52be847987ae47d27dd381ebfcc1af701df4 /main/manager.c | |
parent | 7ce34f4e6a8a2bbfc3cfac9a4465eb0f71372205 (diff) |
manager.c: Fixed "(null):" header in AMI AsyncAGIEnd event
* Changed to create ami_event string only when the given blob is not
json_null().
* Fixed bad expression.
ASTERISK-27621
Change-Id: Ice58c16361f9d9e8648261c9ed5d6c8245fb0d8f
Diffstat (limited to 'main/manager.c')
-rw-r--r-- | main/manager.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/main/manager.c b/main/manager.c index 3aa910501..2df2a46fb 100644 --- a/main/manager.c +++ b/main/manager.c @@ -1770,7 +1770,12 @@ void manager_json_to_ast_str(struct ast_json *obj, const char *key, { struct ast_json_iter *i; - if (!obj || (!res && !(*res) && (!(*res = ast_str_create(1024))))) { + /* If obj or res is not given, just return */ + if (!obj || !res) { + return; + } + + if (!*res && !(*res = ast_str_create(1024))) { return; } @@ -1801,11 +1806,14 @@ void manager_json_to_ast_str(struct ast_json *obj, const char *key, } } - struct ast_str *ast_manager_str_from_json_object(struct ast_json *blob, key_exclusion_cb exclusion_cb) { struct ast_str *res = ast_str_create(1024); - manager_json_to_ast_str(blob, NULL, &res, exclusion_cb); + + if (!ast_json_is_null(blob)) { + manager_json_to_ast_str(blob, NULL, &res, exclusion_cb); + } + return res; } |