Skip to content

Commit

Permalink
fixed null exception when str is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Venclovas committed Jan 29, 2024
1 parent 8eaf3a7 commit 054d223
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/FikaAmazonAPI/ReportGeneration/DataConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ public static class DateTimeFormat
}
public static decimal? GetDecimal(string str)
{
if (decimal.TryParse(str.Replace(",","."), NumberStyles.Any, new CultureInfo("en-US"), out decimal value))
if (decimal.TryParse(str?.Replace(",","."), NumberStyles.Any, new CultureInfo("en-US"), out decimal value))
{
return value;
}
return null;
}
public static int? GetInt(string str)
{
if (int.TryParse(str.Replace(",", "."), NumberStyles.Integer, new CultureInfo("en-US"), out int value))
if (int.TryParse(str?.Replace(",", "."), NumberStyles.Integer, new CultureInfo("en-US"), out int value))
{
return value;
}
return null;
}
public static double? GetDouble(string str)
{
if (double.TryParse(str.Replace(",", "."), NumberStyles.Any, new CultureInfo("en-US"), out double value))
if (double.TryParse(str?.Replace(",", "."), NumberStyles.Any, new CultureInfo("en-US"), out double value))
{
return value;
}
Expand Down

0 comments on commit 054d223

Please sign in to comment.