From 2cf1d72640db040c32cf9fca3a54303471216c61 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 3 Mar 2019 11:56:57 +0100 Subject: [PATCH] Fix if PATH is not set --- src/tests/common-files/gnuplot_i.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/tests/common-files/gnuplot_i.h b/src/tests/common-files/gnuplot_i.h index 5f825b8b5..7683dcba0 100644 --- a/src/tests/common-files/gnuplot_i.h +++ b/src/tests/common-files/gnuplot_i.h @@ -2086,12 +2086,15 @@ bool Gnuplot::get_program_path() { s << path; } - if (s.fail() or s.gcount() == 0) + if (s.fail()) { - throw GnuplotException("PATH is not set"); + throw GnuplotException("PATH is not well defined"); + } + std::string path_str; + if (s.gcount() > 0) + { + path_str = s.str(); } - std::string path_str = s.str(); - std::list ls; //split path (one long string) into list ls of strings