From ee559d1b2aab833e1767e9f97b9b9cf97644bd03 Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Sun, 27 May 2018 22:27:52 +0200 Subject: Handle if some hal info are not available Handle the case if some hal info are not available when the data of all registered hal are requested. Change-Id: Ia55fcc9ff6e964fe23965cf92bb06533c3d11695 Signed-off-by: Jonathan Aillet --- 4a-hal/4a-hal-manager/4a-hal-manager-cb.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to '4a-hal/4a-hal-manager/4a-hal-manager-cb.c') diff --git a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c index 8df79d6..6373dcb 100644 --- a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c +++ b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c @@ -113,20 +113,21 @@ void HalMgrLoaded(afb_request *request) if(! requestJsonErr && requestOptionValue > 0) { for(cpt = 0; cpt < numberOfLoadedApi; cpt++) { wrap_json_pack(&apiObject, - "{s:s s:i s:s s:i s:s s:s s:s}", + "{s:s s:i s:s s:i s:s s:s s:s s:s}", "api", currentHalData->apiName, "status", (int) currentHalData->status, "sndcard", currentHalData->sndCard, "internal", (int) currentHalData->internal, - "author", currentHalData->author, - "version", currentHalData->version, - "date", currentHalData->date); + "info", currentHalData->info ? currentHalData->info : "", + "author", currentHalData->author ? currentHalData->author : "", + "version", currentHalData->version ? currentHalData->version : "", + "date", currentHalData->date ? currentHalData->date : ""); json_object_array_add(requestAnswer, apiObject); currentHalData = currentHalData->next; } } - // Case if request option is empty or not handled + // Case if request is empty or not handled else { for(cpt = 0; cpt < numberOfLoadedApi; cpt++) { json_object_array_add(requestAnswer, json_object_new_string(currentHalData->apiName)); -- cgit 1.2.3-korg