Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit

Permalink
Fix null exception on PropagationHelpers (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjanotti authored Sep 23, 2021
1 parent 26512b4 commit 11c506e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tracer/src/Datadog.Trace/Propagation/PropagationHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Datadog.Trace.Conventions;
using Datadog.Trace.Logging;

Expand All @@ -9,7 +10,7 @@ internal static class PropagationHelpers
{
public static TraceId ParseTraceId<T>(T carrier, Func<T, string, IEnumerable<string>> getter, string headerName, ITraceIdConvention traceIdConvention, IDatadogLogger logger)
{
var headerValues = getter(carrier, headerName);
var headerValues = getter(carrier, headerName) ?? Enumerable.Empty<string>();

foreach (var headerValue in headerValues)
{
Expand All @@ -28,7 +29,7 @@ public static TraceId ParseTraceId<T>(T carrier, Func<T, string, IEnumerable<str

public static string ParseString<T>(T carrier, Func<T, string, IEnumerable<string>> getter, string headerName)
{
var headerValues = getter(carrier, headerName);
var headerValues = getter(carrier, headerName) ?? Enumerable.Empty<string>();

foreach (var headerValue in headerValues)
{
Expand Down

0 comments on commit 11c506e

Please sign in to comment.