From b4aca82992d71d8e4e992be43ac86e13e3028362 Mon Sep 17 00:00:00 2001 From: Marco Clemencic <marco.clemencic@cern.ch> Date: Mon, 9 May 2022 09:56:19 +0200 Subject: [PATCH] Check if the env variable is set before trying to use it --- GaudiPluginService/src/PluginServiceV2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GaudiPluginService/src/PluginServiceV2.cpp b/GaudiPluginService/src/PluginServiceV2.cpp index 801ffc751..7b520e75f 100644 --- a/GaudiPluginService/src/PluginServiceV2.cpp +++ b/GaudiPluginService/src/PluginServiceV2.cpp @@ -156,7 +156,9 @@ namespace Gaudi { std::regex line_format{"^(?:[[:space:]]*(?:(v[0-9]+)::)?([^:]+):(.*[^[:space:]]))?[[:space:]]*(?:#.*)?$"}; std::smatch matches; - std::string search_path = std::getenv( envVar.c_str() ); + std::string search_path; + const char* envPtr = std::getenv( envVar.c_str() ); + if ( envPtr ) search_path = envPtr; if ( search_path.empty() ) { return; } -- GitLab