Skip to contentSkip to conversation

device-mapper/lib libdm-report.c

PATCH [email protected] 1 participant 1 message Jun 25, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/dm
Module name: device-mapper
Changes by: [email protected] 2008-06-25 00:10:36

Modified files:
lib : libdm-report.c

Log message:
Cope with missing field values.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/lib/libdm-report.c.diff?cvsroot=dm&r1=1.21&r2=1.22

lib/libdm-report.c +11 -5
@@ -895,8 +895,13 @@
 	}
 
 	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 @@
 		}
 
 		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)) {