From: Aurelien Jacobs Date: Mon, 13 Jan 2014 22:38:32 +0000 (+0100) Subject: rigol-ds: prevent config_list() to return empty g_variant X-Git-Tag: libsigrok-0.3.0~300 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a31b2ccbd8db3716d2b13971a8519631e06727fa;p=libsigrok.git rigol-ds: prevent config_list() to return empty g_variant This fixes the following glib message: $ ./sigrok-cli -d rigol-ds --show [...] g_variant_builder_end: assertion '!GVSB(builder)->uniform_item_types || GVSB(builder)->prev_item_type != NULL || g_variant_type_is_definite (GVSB(builder)->type)' failed --- diff --git a/hardware/rigol-ds/api.c b/hardware/rigol-ds/api.c index bea79c3e..d4e12daf 100644 --- a/hardware/rigol-ds/api.c +++ b/hardware/rigol-ds/api.c @@ -721,6 +721,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, if (!devc) /* Can't know this until we have the exact model. */ return SR_ERR_ARG; + if (devc->num_timebases <= 0) + return SR_ERR_NA; g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY); for (i = 0; i < devc->num_timebases; i++) { rational[0] = g_variant_new_uint64(devc->timebases[i][0]);