Fix: return error on empty list in get_unary_unsigned
[babeltrace.git] / plugins / ctf / common / metadata / visitor-generate-ir.c
index badbf995bacaecbd99a97857a252372ca706cad3..fb0f1df11045c0ccce1c04e97608286a65dc89af 100644 (file)
@@ -855,6 +855,11 @@ int get_unary_unsigned(struct bt_list_head *head, uint64_t *value)
        int ret = 0;
        struct ctf_node *node;
 
+       if (bt_list_empty(head)) {
+               ret = -1;
+               goto end;
+       }
+
        bt_list_for_each_entry(node, head, siblings) {
                int uexpr_type = node->u.unary_expression.type;
                int uexpr_link = node->u.unary_expression.link;
This page took 0.02287 seconds and 4 git commands to generate.