Skip to content

Commit

Permalink
Remove some unnecessary null checks (#1801)
Browse files Browse the repository at this point in the history
### Motivation and Context

The culture will never be null here so these fallbacks aren't ever used.

### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows SK Contribution Guidelines
(https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
- [x] The code follows the .NET coding conventions
(https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions)
verified with `dotnet format`
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
  • Loading branch information
stephentoub committed Jul 3, 2023
1 parent 3105aa1 commit 6600204
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dotnet/src/SemanticKernel/SkillDefinition/SKFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ private static void TrackUniqueParameterType(ref bool hasParameterType, MethodIn
// If that fails, try with the invariant culture and allow any exception to propagate.
try
{
return converter.ConvertFromString(context: null, cultureInfo ?? CultureInfo.CurrentCulture, input);
return converter.ConvertFromString(context: null, cultureInfo, input);
}
catch (Exception e) when (!e.IsCriticalException() && cultureInfo != CultureInfo.InvariantCulture)
{
Expand Down Expand Up @@ -974,7 +974,7 @@ private static void TrackUniqueParameterType(ref bool hasParameterType, MethodIn
return null!;
}
return converter.ConvertToString(context: null, cultureInfo ?? CultureInfo.InvariantCulture, input);
return converter.ConvertToString(context: null, cultureInfo, input);
};
}
Expand Down

0 comments on commit 6600204

Please sign in to comment.