Skip to content

Commit 0b97311

Browse files
Fix NullReferenceException thrown in CreateAddCustomHeadersPolicy when OpenAIClientOptions is null (#85)
* Fix NullReferenceException thrown when adding the custom headers policy while OpenAIClientOptions is null * .csproj version increment --------- Co-authored-by: Travis Wilson <[email protected]>
1 parent 744afe7 commit 0b97311

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 2.0.0-beta.7 (Unreleased)
4+
5+
## Bugs Fixed
6+
7+
- ([#84](https://github.com./openai/openai-dotnet/issues/84)) Fixed a `NullReferenceException` thrown when adding the custom headers policy while `OpenAIClientOptions` is null (commit_hash)
8+
39
## 2.0.0-beta.6 (2024-06-21)
410

511
## Features Added

src/Custom/OpenAIClient.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,11 @@ private static PipelinePolicy CreateAddCustomHeadersPolicy(OpenAIClientOptions o
277277
message.Request.Headers.Set(UserAgentHeaderName, telemetryDetails.ToString());
278278
}
279279

280-
if (!string.IsNullOrEmpty(options.OrganizationId))
280+
if (!string.IsNullOrEmpty(options?.OrganizationId))
281281
{
282282
message.Request.Headers.Set(OpenAIOrganizationHeaderName, options.OrganizationId);
283283
}
284-
if (!string.IsNullOrEmpty(options.ProjectId))
284+
if (!string.IsNullOrEmpty(options?.ProjectId))
285285
{
286286
message.Request.Headers.Set(OpenAIProjectHeaderName, options.ProjectId);
287287
}

src/OpenAI.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<PackageTags>OpenAI</PackageTags>
66

77
<VersionPrefix>2.0.0</VersionPrefix>
8-
<VersionSuffix>beta.6</VersionSuffix>
8+
<VersionSuffix>beta.7</VersionSuffix>
99

1010
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
1111
<LangVersion>latest</LangVersion>

0 commit comments

Comments
 (0)