diff --git a/.github/workflows/linux_llvm_cov.yml b/.github/workflows/linux_llvm_cov.yml index 08cc89cc2..a1a7f1769 100644 --- a/.github/workflows/linux_llvm_cov.yml +++ b/.github/workflows/linux_llvm_cov.yml @@ -44,8 +44,11 @@ jobs: ./easylog_test ./struct_pack_test ./struct_pack_test_with_optimize + ./metric_test + ./struct_pb_test + ./reflection_test llvm-profdata merge -sparse test_ylt-*.profraw -o test_ylt.profdata - llvm-cov show coro_io_test -object coro_rpc_test -object easylog_test -object struct_pack_test -object struct_pack_test_with_optimize -instr-profile=test_ylt.profdata -format=html -output-dir=../../.coverage_llvm_cov -ignore-filename-regex="thirdparty|asio|src" -show-instantiations=false + llvm-cov show coro_io_test -object coro_rpc_test -object easylog_test -object struct_pack_test -object struct_pack_test_with_optimize ./metric_test ./struct_pb_test ./reflection_test -instr-profile=test_ylt.profdata -format=html -output-dir=../../.coverage_llvm_cov -ignore-filename-regex="thirdparty|asio|src" -show-instantiations=false echo "Done!" - name: Upload Coverage Results diff --git a/include/ylt/metric/dynamic_metric.hpp b/include/ylt/metric/dynamic_metric.hpp index 9753fb93c..6ddce3f51 100644 --- a/include/ylt/metric/dynamic_metric.hpp +++ b/include/ylt/metric/dynamic_metric.hpp @@ -97,8 +97,10 @@ class dynamic_metric_impl : public dynamic_metric { return map_.try_emplace_with_op( view, [](auto result) { - *const_cast*>(&result.first->first) = - result.first->second->label; + if (result.second) { + *const_cast*>( + &result.first->first) = result.first->second->label; + } }, std::forward(key), std::forward(args)...); }