summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-07-04 17:30:02 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-07-05 07:27:03 +0000
commite45d063fb5b4c45d92eb74df985075813e3b71a4 (patch)
tree14843099ac8bb313f8f8fd3039de2cd557151fb3
parent2d1c3d2dcd47b13497ef7d0d85f3fc8d90d1b9c5 (diff)
Execute ConfigExec only if section is existing
Test again if the section is present in the configuration JSON object before executing the callback. Change-Id: Ibad352e8443d5d33d7e727fc3b80c56a377c75d3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--ctl-lib/ctl-config.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ctl-lib/ctl-config.c b/ctl-lib/ctl-config.c
index fcd0e02..3153f13 100644
--- a/ctl-lib/ctl-config.c
+++ b/ctl-lib/ctl-config.c
@@ -154,7 +154,7 @@ int CtlConfigExec(AFB_ApiT apiHandle, CtlConfigT *ctlConfig) {
if (!ctlConfig->sections[idx].loadCB)
AFB_ApiNotice(apiHandle, "CtlConfigLoad: notice empty section '%s'", ctlConfig->sections[idx].key);
- else
+ else if (json_object_object_get_ex(ctlConfig->configJ, ctlConfig->sections[idx].key, NULL))
errcount += ctlConfig->sections[idx].loadCB(apiHandle, &ctlConfig->sections[idx], NULL);
}