From af1b484d53c5f0e22d254100923b0d4a71892f9c Mon Sep 17 00:00:00 2001 From: Tianlin Zhao Date: Thu, 20 Aug 2020 14:24:58 -0400 Subject: [PATCH] resolving Null issue of span --- .../opentelemetry/trace/propagation/http_trace_context.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/include/opentelemetry/trace/propagation/http_trace_context.h b/api/include/opentelemetry/trace/propagation/http_trace_context.h index 8a1ce26a37..b3585f46c4 100644 --- a/api/include/opentelemetry/trace/propagation/http_trace_context.h +++ b/api/include/opentelemetry/trace/propagation/http_trace_context.h @@ -87,11 +87,10 @@ class HttpTraceContext : public HTTPTextFormat const nostd::string_view span_key = "current-span"; context::Context ctx(context); context::ContextValue span = ctx.GetValue(span_key); - if (nostd::get(span) == 0) + if (nostd::holds_alternative>(span)) { - return; + span_context = nostd::get>(span).get().GetContext(); } - span_context = nostd::get>(span).get().GetContext(); } static TraceId GenerateTraceIdFromString(nostd::string_view trace_id)