Skip to content

Commit a1e6ad8

Browse files
authored
Fix null reference exception in user agent handling (#3946)
1 parent 14856e6 commit a1e6ad8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Runner.Worker/JobRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public async Task<TaskResult> RunAsync(AgentJobRequestMessage message, Cancellat
5050
if (message.Variables.TryGetValue(Constants.Variables.System.OrchestrationId, out VariableValue orchestrationId) &&
5151
!string.IsNullOrEmpty(orchestrationId.Value))
5252
{
53-
if (!HostContext.UserAgents.Any(x => string.Equals(x.Product.Name, "OrchestrationId", StringComparison.OrdinalIgnoreCase)))
53+
if (!HostContext.UserAgents.Any(x => string.Equals(x.Product?.Name, "OrchestrationId", StringComparison.OrdinalIgnoreCase)))
5454
{
5555
// make the orchestration id the first item in the user-agent header to avoid get truncated in server log.
5656
HostContext.UserAgents.Insert(0, new ProductInfoHeaderValue("OrchestrationId", orchestrationId.Value));

0 commit comments

Comments
 (0)