From 6cd62d9bb4c93634699976eaed2af9e463214e37 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 27 Feb 2006 15:32:17 +0000 Subject: [PATCH] forcing array-ness on non-existant params git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@648 9efc2488-bf62-4759-914b-345cdb29e865 --- src/libstack/osrf_message.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libstack/osrf_message.c b/src/libstack/osrf_message.c index 14452bf..51a9119 100644 --- a/src/libstack/osrf_message.c +++ b/src/libstack/osrf_message.c @@ -51,7 +51,7 @@ void osrf_message_set_params( osrf_message* msg, jsonObject* o ) { /* only works if parse_json_params is false */ void osrf_message_add_param( osrf_message* msg, char* param_string ) { if(msg == NULL || param_string == NULL) return; - if(!msg->_params) msg->_params = jsonNewObject(NULL); + if(!msg->_params) msg->_params = jsonParseString("[]"); jsonObjectPush(msg->_params, jsonParseString(param_string)); } @@ -288,6 +288,8 @@ int osrf_message_deserialize(char* string, osrf_message* msgs[], int count) { if(tmp0) { char* s = jsonObjectToJSON(tmp0); new_msg->_params = jsonParseString(s); + if(new_msg->_params && new_msg->_params->type == JSON_NULL) + new_msg->_params->type = JSON_ARRAY; free(s); } -- 2.11.0