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

Jenkins2 asteriskteam at digium.com
Mon Feb 5 12:26:57 CST 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/8150 )

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(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Sean Bright: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/main/manager.c b/main/manager.c
index 576978c..da860f0 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1770,7 +1770,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;
 	}
 
@@ -1801,11 +1806,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/8150
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: Ice58c16361f9d9e8648261c9ed5d6c8245fb0d8f
Gerrit-Change-Number: 8150
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180205/a2f3e56c/attachment.html>


More information about the asterisk-code-review mailing list