attempting to fix the extra null in respondComplete
authormiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 31 May 2006 17:25:53 +0000 (17:25 +0000)
committermiker <miker@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 31 May 2006 17:25:53 +0000 (17:25 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@732 9efc2488-bf62-4759-914b-345cdb29e865

src/libstack/osrf_app_session.c
src/libstack/osrf_application.c

index b65c941..e9b88e1 100644 (file)
@@ -618,20 +618,25 @@ int osrfAppRequestRespondComplete(
        osrf_message* payload = osrf_message_init( RESULT, requestId, 1 );
        osrf_message_set_status_info( payload, NULL, "OK", OSRF_STATUS_OK );
 
-       char* json = jsonObjectToJSON( data );
-       osrf_message_set_result_content( payload, json );
-       free(json);
-
        osrf_message* status = osrf_message_init( STATUS, requestId, 1);
        osrf_message_set_status_info( status, "osrfConnectStatus", "Request Complete", OSRF_STATUS_COMPLETE );
+       
+       if (data) {
+               char* json = jsonObjectToJSON( data );
+               osrf_message_set_result_content( payload, json );
+               free(json);
 
-       osrfMessage* ms[2];
-       ms[0] = payload;
-       ms[1] = status;
+               osrfMessage* ms[2];
+               ms[0] = payload;
+               ms[1] = status;
 
-       osrfAppSessionSendBatch( ses, ms, 2 );
+               osrfAppSessionSendBatch( ses, ms, 2 );
+
+               osrf_message_free( payload );
+       } else {
+               osrfAppSessionSendBatch( ses, &status, 1 );
+       }
 
-       osrf_message_free( payload );
        osrf_message_free( status );
 
        /* join and free */
index d4b954e..cf49c12 100644 (file)
@@ -275,7 +275,9 @@ int _osrfAppRespond( osrfMethodContext* ctx, jsonObject* data, int complete ) {
 
                if( ctx->responses == NULL )                                                                                            
                        ctx->responses = jsonParseString("[]");                                                 
-               jsonObjectPush( ctx->responses, jsonObjectClone(data) );        
+
+               if ( data != NULL )
+                       jsonObjectPush( ctx->responses, jsonObjectClone(data) );        
        }