diff options
author | Thierry Bultel <thierry.bultel@iot.bzh> | 2018-09-07 16:13:55 +0200 |
---|---|---|
committer | Thierry Bultel <thierry.bultel@iot.bzh> | 2018-09-07 16:13:55 +0200 |
commit | 9c0aa9f3073a37e961a90a973b8d007685c9e184 (patch) | |
tree | 7b4f9778a75958cff3c04b71af303992505629b2 /plugins/alsa/alsa-api-mixer.c | |
parent | 168e9288f1ff147d9aaa6064c3cc0308fd214a6a (diff) |
fixed crash upon misconfiguration of capture/playback devices
The null pcmplug case was not correctly handled in various places.
Also fixed some typos in the log
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins/alsa/alsa-api-mixer.c')
-rw-r--r-- | plugins/alsa/alsa-api-mixer.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/alsa/alsa-api-mixer.c b/plugins/alsa/alsa-api-mixer.c index c4b016c..07bcf12 100644 --- a/plugins/alsa/alsa-api-mixer.c +++ b/plugins/alsa/alsa-api-mixer.c @@ -641,13 +641,15 @@ OnErrorExit: static void MixerBluezAlsaDevVerb(AFB_ReqT request) { SoftMixerT *mixer = (SoftMixerT*) afb_req_get_vcbdata(request); - + char * interface = NULL, *device = NULL, *profile = NULL; json_object *argsJ = afb_req_json(request); - json_object *responseJ = json_object_new_object(); + int error; - char * interface = NULL, *device = NULL, *profile = NULL; + if (!json_object_is_type(argsJ,json_type_null)) { + goto parsed; + } - int error; + json_object *responseJ = json_object_new_object(); error = wrap_json_unpack(argsJ, "{ss,ss,ss !}" , "interface", &interface @@ -663,8 +665,8 @@ static void MixerBluezAlsaDevVerb(AFB_ReqT request) { goto OnErrorExit; } - printf("%s: interface %s, device %s, profile %s\n", __func__, interface, device, profile); - +parsed: + printf("%s: interface %s, device %s, profile %s\n", __func__, interface, device, profile); error = alsa_bluez_set_device(interface, device, profile); if (error) { AFB_ReqFailF(request, |