]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: prevent config_list() to return empty g_variant
authorAurelien Jacobs <redacted>
Mon, 13 Jan 2014 22:38:32 +0000 (23:38 +0100)
committerBert Vermeulen <redacted>
Mon, 13 Jan 2014 23:01:50 +0000 (00:01 +0100)
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

hardware/rigol-ds/api.c

index bea79c3eb5ab0c35f4065f3b84ab6a7a8b500801..d4e12daf8b6b447e9d55ec4aeeaadf5152544d65 100644 (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]);