Skip to content

Commit

Permalink
Merge pull request #177 from mivano/fix/budget-csv-formatter
Browse files Browse the repository at this point in the history
Fix null instance when exporting budgets via CSV
  • Loading branch information
mivano authored Sep 18, 2024
2 parents 3604051 + c2a35fb commit 4f0e090
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/OutputFormatters/CsvOutputFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ public class CustomDoubleConverter : DoubleConverter
{
public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)

Check warning on line 183 in src/OutputFormatters/CsvOutputFormatter.cs

View workflow job for this annotation

GitHub Actions / build

Nullability of type of parameter 'value' doesn't match overridden member (possibly because of nullability attributes).

Check warning on line 183 in src/OutputFormatters/CsvOutputFormatter.cs

View workflow job for this annotation

GitHub Actions / build-pack-release

Nullability of type of parameter 'value' doesn't match overridden member (possibly because of nullability attributes).
{
double number = (double)value;
return number.ToString("F8", CultureInfo.InvariantCulture);
return value switch
{
null => string.Empty,
double number => number.ToString("F8", CultureInfo.InvariantCulture),
_ => throw new InvalidOperationException("The value is not a double.")
};
}
}

0 comments on commit 4f0e090

Please sign in to comment.