instead of checking for NULL from last_seg and first_seg.
}
}
- if ((seg = last_seg(lv)) && (seg->segtype == segtype)) {
+ if (!dm_list_empty(&lv->segments) &&
+ (seg = last_seg(lv)) && (seg->segtype == segtype)) {
seg->area_len += extents;
seg->len += extents;
} else {
char img_name[len];
struct lv_segment *mapseg;
- if (lv->le_count || first_seg(lv)) {
+ if (lv->le_count || !dm_list_empty(&lv->segments)) {
log_error(INTERNAL_ERROR
"Non-empty LV passed to _lv_insert_empty_sublv");
return 0;