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

sungtae kim asteriskteam at digium.com
Fri Feb 2 06:24:59 CST 2018


sungtae kim has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/50/8150/1

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: newchange
Gerrit-Change-Id: Ice58c16361f9d9e8648261c9ed5d6c8245fb0d8f
Gerrit-Change-Number: 8150
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/cbc11513/attachment-0001.html>


More information about the asterisk-code-review mailing list