diff --git a/aql2/src/aql.cpp b/aql2/src/aql.cpp index 6ab6ad61d15f2768c28266f4487a208e50a92836..be2832c93f1e3b5b76e25934546388fd7ff282fb 100644 --- a/aql2/src/aql.cpp +++ b/aql2/src/aql.cpp @@ -97,10 +97,14 @@ int main ( int argc, char * argv[] ) { exceptions.push_back ( exception.error ( ) ); } ); - const char* envHome = std::getenv ( "HOME" ); + std::optional < std::filesystem::path > envHomePath; + if ( auto *env = std::getenv ( "HOME" ) ) { + envHomePath = std::string ( env ); + } + std::unique_ptr < ReadlinePromptHistory > historyHandler; - if ( envHome != nullptr ) { - historyHandler = std::make_unique < ReadlinePromptHistory > ( std::string ( envHome ) + "/.aql_history" ); + if ( envHomePath ) { + historyHandler = std::make_unique < ReadlinePromptHistory > ( envHomePath.value ( ) / ".aql_history" ); } try {