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
This commit is contained in:
Aurelien Jacobs 2014-01-13 23:38:32 +01:00 committed by Bert Vermeulen
parent 69d83be9bf
commit a31b2ccbd8
1 changed files with 2 additions and 0 deletions

View File

@ -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]);