From 37c8479b8687a295716fb7e4fd3012ac2c74c749 Mon Sep 17 00:00:00 2001 From: Siddharth Bhat Date: Mon, 1 Apr 2024 17:00:23 +0100 Subject: [PATCH] baseline runtime: gracefully do not log if profile path does not exist --- src/runtime/research.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/research.cpp b/src/runtime/research.cpp index f4462bbb77ab..7927ec9c5cb9 100644 --- a/src/runtime/research.cpp +++ b/src/runtime/research.cpp @@ -76,7 +76,8 @@ extern "C" { // TODO: rename into research_runtime_dump_allocator_log_at_end_of_run(); void research_dump_allocator_log() { const char *envVarName = "RESEARCH_LEAN_RUNTIME_ALLOCATOR_LOG"; - std::string out_path = std::getenv(envVarName); + const char *_envVarName = std::getenv(envVarName); + std::string out_path(_envVarName ? _envVarName : ""); if (out_path == "") { return; } std::ofstream *of = NULL;