Skip to content

Commit

Permalink
hotfix su number of column
Browse files Browse the repository at this point in the history
  • Loading branch information
Federico Mazzanti committed Sep 9, 2024
1 parent 64cf973 commit 06e3b8c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/TinyCsv/Extensions/StringArrayExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ public static T GetModelFromStringArray<T>(this string[] values, CsvOptions<T> o

foreach (var column in options.Columns)
{
var value = values[column.ColumnIndex];
var propertyName = column.ColumnNameInternal;
var property = options.FasterProperties[propertyName];
var typedValue = column.Converter.ConvertBack(value, column.ColumnType, null, column.ColumnFormatProvider);
property.Setter(model, typedValue);
if (column.ColumnIndex < values.Length)
{
var value = values[column.ColumnIndex];
var propertyName = column.ColumnNameInternal;
var property = options.FasterProperties[propertyName];
var typedValue = column.Converter.ConvertBack(value, column.ColumnType, null, column.ColumnFormatProvider);
property.Setter(model, typedValue);
}
}

return model;
Expand Down
2 changes: 1 addition & 1 deletion src/TinyCsv/TinyCsv.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<AssemblyName>Mafe.$(MSBuildProjectName)</AssemblyName>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Product>TinyCsv</Product>
<Version>2.2.1</Version>
<Version>2.2.2</Version>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 06e3b8c

Please sign in to comment.