]> sourceware.org Git - lvm2.git/commitdiff
Cope with missing field values.
authorAlasdair Kergon <agk@redhat.com>
Wed, 25 Jun 2008 00:10:36 +0000 (00:10 +0000)
committerAlasdair Kergon <agk@redhat.com>
Wed, 25 Jun 2008 00:10:36 +0000 (00:10 +0000)
libdm/libdm-report.c

index 08c606c8afeb0f15db66a21baee76ba28e824480..b496200a026bd744fc364d18ac40273a6d780e94 100644 (file)
@@ -895,8 +895,13 @@ static int _output_as_rows(struct dm_report *rh)
        }
 
        list_iterate_items(fp, &rh->field_props) {
-               if (fp->flags & FLD_HIDDEN)
+               if (fp->flags & FLD_HIDDEN) {
+                       list_iterate_items(row, &rh->rows) {
+                               field = list_item(list_first(&row->fields), struct dm_report_field);
+                               list_del(&field->list);
+                       }
                        continue;
+               }
 
                if ((rh->flags & DM_REPORT_OUTPUT_HEADINGS)) {
                        if (!dm_pool_grow_object(rh->mem, rh->fields[fp->field_num].heading, 0)) {
@@ -910,10 +915,11 @@ static int _output_as_rows(struct dm_report *rh)
                }
 
                list_iterate_items(row, &rh->rows) {
-                       field = list_item(list_first(&row->fields), struct dm_report_field);
-                       if (!_output_field(rh, field))
-                               goto bad;
-                       list_del(&field->list);
+                       if ((field = list_item(list_first(&row->fields), struct dm_report_field))) {
+                               if (!_output_field(rh, field))
+                                       goto bad;
+                               list_del(&field->list);
+                       }
 
                        if (!list_end(&rh->rows, &row->list))
                                if (!dm_pool_grow_object(rh->mem, rh->separator, 0)) {
This page took 0.042899 seconds and 5 git commands to generate.