Skip to content

Commit 5bc97c4

Browse files
committed
Nullable Fixes;
1 parent 1a50707 commit 5bc97c4

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

src/GrokSdk/GrokSdk.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<!-- NuGet Metadata -->
1010
<NuspecFile>GrokSdk.nuspec</NuspecFile>
1111
<PackageId>Grok</PackageId>
12-
<Version>1.0.0</Version>
12+
<Version>1.0.1</Version>
1313
<Authors>TWhidden</Authors>
1414
<Description>xAI Grok dotnet integration</Description>
1515
<PackageTags>xAI;Grok;dotnet</PackageTags>

src/GrokSdk/GrokSdk.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata>
44
<id>GrokSdk</id>
5-
<version>1.0.0</version>
5+
<version>1.0.1</version>
66
<authors>Travis Whidden</authors>
77
<description>xAI Grok dotnet integration</description>
88
<tags>xAI Grok dotnet</tags>

src/GrokSdk/Tools/GrokToolImageGeneration.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@ public async Task<string> ExecuteAsync(string arguments)
6767
try
6868
{
6969
var args = JsonConvert.DeserializeObject<GrokToolImageGenerationArgs>(arguments);
70-
if (string.IsNullOrEmpty(args?.Prompt))
70+
if (args == null)
71+
return JsonConvert.SerializeObject(new { error = "Arguments are null." });
72+
if (string.IsNullOrEmpty(args.Prompt))
7173
return JsonConvert.SerializeObject(new { error = "Prompt cannot be empty." });
72-
if (args.N < 1 || args.N > 10)
74+
if (args.N is < 1 or > 10)
7375
return JsonConvert.SerializeObject(new { error = "n must be between 1 and 10." });
7476
if (args.ResponseFormat != "url" && args.ResponseFormat != "base64")
7577
return JsonConvert.SerializeObject(

src/GrokSdk/Tools/GrokToolReasoning.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public GrokToolReasoning(GrokClient client, string grokModel = "grok-3-mini-beta
5454
/// <returns>A task resolving to a JSON-serialized string with the reasoning result or an error message.</returns>
5555
public async Task<string> ExecuteAsync(string arguments)
5656
{
57-
ReasoningArgs args;
57+
ReasoningArgs? args;
5858
try
5959
{
6060
args = JsonConvert.DeserializeObject<ReasoningArgs>(arguments);
@@ -64,6 +64,9 @@ public async Task<string> ExecuteAsync(string arguments)
6464
return JsonConvert.SerializeObject(new { error = $"Invalid arguments: {ex.Message}" });
6565
}
6666

67+
if (args == null)
68+
return JsonConvert.SerializeObject(new { error = "Args are null" });
69+
6770
if (string.IsNullOrEmpty(args.Problem))
6871
return JsonConvert.SerializeObject(new { error = "Problem cannot be empty." });
6972

0 commit comments

Comments
 (0)