summaryrefslogtreecommitdiffstats
path: root/src/afb-msg-json.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/afb-msg-json.c')
-rw-r--r--src/afb-msg-json.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/afb-msg-json.c b/src/afb-msg-json.c
index d5f6f5a5..8f543ff1 100644
--- a/src/afb-msg-json.c
+++ b/src/afb-msg-json.c
@@ -47,13 +47,15 @@ struct json_object *afb_msg_json_reply(const char *status, const char *info, str
if (reqid != NULL)
json_object_object_add(request, "reqid", json_object_new_string(reqid));
- token = afb_context_sent_token(context);
- if (token != NULL)
- json_object_object_add(request, "token", json_object_new_string(token));
-
- uuid = afb_context_sent_uuid(context);
- if (uuid != NULL)
- json_object_object_add(request, "uuid", json_object_new_string(uuid));
+ if (context != NULL) {
+ token = afb_context_sent_token(context);
+ if (token != NULL)
+ json_object_object_add(request, "token", json_object_new_string(token));
+
+ uuid = afb_context_sent_uuid(context);
+ if (uuid != NULL)
+ json_object_object_add(request, "uuid", json_object_new_string(uuid));
+ }
return msg;
}