summaryrefslogtreecommitdiffstats
path: root/Alsa-afb
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2017-08-27 18:09:54 +0200
committerFulup Ar Foll <fulup@iot.bzh>2017-08-27 18:09:54 +0200
commit1dd19ac494da7b223bc919a85c0e6c16502e9a77 (patch)
treef37e3ff2b39bbe44fd863ad3ffd5724275b002d1 /Alsa-afb
parente9b532488dff41b1215a8c92820a55fe6847e2f1 (diff)
Fix Alsacore ctlget in form ctl={id:xxx}
Diffstat (limited to 'Alsa-afb')
-rw-r--r--Alsa-afb/Alsa-SetGet.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/Alsa-afb/Alsa-SetGet.c b/Alsa-afb/Alsa-SetGet.c
index 71206e6..f70c5d6 100644
--- a/Alsa-afb/Alsa-SetGet.c
+++ b/Alsa-afb/Alsa-SetGet.c
@@ -76,12 +76,18 @@ PUBLIC void NumidsListParse(ActionSetGetT action, queryValuesT *queryValues, ctl
case json_type_object:
// numid+values formated as {id:xxx, val:[aa,bb...,nn]}
- if (!json_object_object_get_ex(ctlRequest[idx].jToken, "id", &jId) || !json_object_object_get_ex(ctlRequest[idx].jToken, "val", &valuesJ)) {
- AFB_NOTICE("Invalid Json=%s missing 'id'|'val'", json_object_get_string(ctlRequest[idx].jToken));
+ if (!json_object_object_get_ex(ctlRequest[idx].jToken, "id", &jId)) {
+ AFB_NOTICE("Invalid Json=%s missing 'id'", json_object_get_string(ctlRequest[idx].jToken));
ctlRequest[idx].used = -1;
} else {
ctlRequest[idx].numId = json_object_get_int(jId);
- if (action == ACTION_SET) ctlRequest[idx].valuesJ = valuesJ;
+ if (action == ACTION_SET) {
+ if (!json_object_object_get_ex(ctlRequest[idx].jToken, "val", &valuesJ)) {
+ AFB_NOTICE("Invalid Json=%s missing 'val'", json_object_get_string(ctlRequest[idx].jToken));
+ ctlRequest[idx].used = -1;
+ } else
+ ctlRequest[idx].valuesJ = valuesJ;
+ }
}
break;