[Asterisk-code-review] manager.c: Fixed "(null):" header in AMI AsyncAGIEnd event (asterisk[15.2])

sungtae kim asteriskteam at digium.com
Fri Feb 2 06:13:04 CST 2018


sungtae kim has uploaded this change for review. ( https://gerrit.asterisk.org/8147


Change subject: manager.c: Fixed "(null):" header in AMI AsyncAGIEnd event
......................................................................

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
---
M main/manager.c
1 file changed, 11 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/47/8147/1

diff --git a/main/manager.c b/main/manager.c
index 71d7432..64dab22 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1768,7 +1768,12 @@
 {
 	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;
 	}
 
@@ -1799,11 +1804,14 @@
 	}
 }
 
-
 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;
 }
 

-- 
To view, visit https://gerrit.asterisk.org/8147
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15.2
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice58c16361f9d9e8648261c9ed5d6c8245fb0d8f
Gerrit-Change-Number: 8147
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180202/7cce9bd8/attachment.html>


More information about the asterisk-code-review mailing list