]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
manager.c: Fixed "(null):" header in AMI AsyncAGIEnd event
authorSungtae Kim <pchero21@gmail.com>
Thu, 25 Jan 2018 01:58:22 +0000 (02:58 +0100)
committersungtae kim <pchero21@gmail.com>
Fri, 2 Feb 2018 12:25:06 +0000 (06:25 -0600)
* Changed to create ami_event string only when the given blob is not
json_null().
* Fixed bad expression.

ASTERISK-27621

Change-Id: Ice58c16361f9d9e8648261c9ed5d6c8245fb0d8f

main/manager.c

index 4e611a085b7c4b00adaabb0a8497f346e097bfa6..cfe1cbfdd050b802974ed88669879735104b23c7 100644 (file)
@@ -1766,7 +1766,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;
        }
 
@@ -1797,11 +1802,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;
 }