From ae5d5b65bd38d30fa6f9ce1ce227326da65f6665 Mon Sep 17 00:00:00 2001 From: Matthew Kotila Date: Mon, 4 Mar 2024 17:48:00 -0800 Subject: [PATCH] Fix bug --- src/c++/perf_analyzer/profile_data_exporter.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/c++/perf_analyzer/profile_data_exporter.cc b/src/c++/perf_analyzer/profile_data_exporter.cc index 493e58411..3bcd6f83e 100644 --- a/src/c++/perf_analyzer/profile_data_exporter.cc +++ b/src/c++/perf_analyzer/profile_data_exporter.cc @@ -164,9 +164,13 @@ ProfileDataExporter::AddResponseOutputs( const auto& byte_size{output.second.second}; rapidjson::Value name_json(name.c_str(), document_.GetAllocator()); rapidjson::Value output_json{}; - output_json.SetString( - reinterpret_cast(buf), byte_size, - document_.GetAllocator()); + if (buf != nullptr) { + output_json.SetString( + reinterpret_cast(buf), byte_size, + document_.GetAllocator()); + } else { + output_json.SetString("", 0, document_.GetAllocator()); + } response_output_json.AddMember( name_json, output_json, document_.GetAllocator()); }