Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix null instance when exporting budgets via CSV #177

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/OutputFormatters/CsvOutputFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@

public class TagsConverter : DefaultTypeConverter
{
public override string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)

Check warning on line 172 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).
{
if (value == null)
return string.Empty;
Expand All @@ -180,9 +180,13 @@

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).
{
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.")
};
}
}
Loading