lib/rbbt/tsv/accessor.rb in rbbt-util-5.12.1 vs lib/rbbt/tsv/accessor.rb in rbbt-util-5.12.2

- old
+ new

@@ -619,24 +619,25 @@ end new.type = :double else self.through do |key,values| field_values = values.delete_at field_pos - zipped = values.zip_fields + zipped = Misc.zip_fields(values) field_values.zip(zipped).each do |field_value,rest| k = [key,field_value]*":" new[k] = rest end end new.type = :list end end - - new.key_field = [self.key_field, self.fields[field_pos]] * ":" - new_fields = self.fields.dup - new_fields.delete_at field_pos - new.fields = new_fields + if self.key_field and self.fields + new.key_field = [self.key_field, self.fields[field_pos]] * ":" + new_fields = self.fields.dup + new_fields.delete_at field_pos + new.fields = new_fields + end new end end