X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fhp-3457a%2Fapi.c;fp=src%2Fhardware%2Fhp-3457a%2Fapi.c;h=64fdab54deef5cbc875d57f3b3c07fbb84a498c5;hb=1674225a2fa7e1b6d0c235549e1a7f6ec44e7520;hp=5325224e5e8207e7593b5a0c55765e20866be7e2;hpb=e93ca8a4d66a42517a21f6c34bba7cd73dc042d8;p=libsigrok.git diff --git a/src/hardware/hp-3457a/api.c b/src/hardware/hp-3457a/api.c index 5325224e..64fdab54 100644 --- a/src/hardware/hp-3457a/api.c +++ b/src/hardware/hp-3457a/api.c @@ -359,8 +359,13 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return SR_ERR_ARG; } - devc->current_channel = devc->active_channels->data; devc->num_active_channels = g_slist_length(devc->active_channels); + if (!devc->num_active_channels) { + sr_err("Need at least one active channel!"); + g_slist_free(devc->active_channels); + return SR_ERR_ARG; + } + devc->current_channel = devc->active_channels->data; hp_3457a_select_input(sdi, front_selected ? CONN_FRONT : CONN_REAR);