summaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-plugin.c
diff options
context:
space:
mode:
authorFrederic Marec <frederic.marec@iot.bzh>2018-11-28 09:33:23 +0100
committerFrédéric Marec <frederic.marec@iot.bzh>2018-11-30 08:46:17 +0000
commit70e1d98f1118c4785dde75cb64af9272fce11677 (patch)
tree488bba53697bdea0c0b844c15a4d0801be779652 /ctl-lib/ctl-plugin.c
parent309003b66de9c62c36a8063925e017a8a0b2cdf0 (diff)
Fix Parse plugin
Fix PluginParse in ctlplugin to handle json_object case Change-Id: Iaeacaaef3dc09ca28229e16aed992003aa3b02cf Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-plugin.c')
-rw-r--r--ctl-lib/ctl-plugin.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ctl-lib/ctl-plugin.c b/ctl-lib/ctl-plugin.c
index 12bf963..be3a2bf 100644
--- a/ctl-lib/ctl-plugin.c
+++ b/ctl-lib/ctl-plugin.c
@@ -417,7 +417,8 @@ static int PluginParse(AFB_ApiT apiHandle, CtlSectionT *section, json_object *pl
memcpy(ctlPluginsNew, ctlPluginsOrig, idx * sizeof(CtlPluginT));
while(idx < totalPluginNumber) {
- json_object *pluginJ = json_object_array_get_idx(pluginsJ, idx);
+ json_object *pluginJ = json_object_is_type(pluginsJ, json_type_array) ?
+ json_object_array_get_idx(pluginsJ, idx) : pluginsJ;
err += PluginLoad(apiHandle, &ctlPluginsNew[idx], pluginJ, section->handle, section->prefix);
idx++;
}