Skip to content

Commit

Permalink
[graph] warn user when input format mismatch / no points found in file
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdymercury authored and guitargeek committed Jun 3, 2024
1 parent ac1808b commit e3f3f29
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hist/hist/src/TGraph.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ TGraph::TGraph(const TF1 *f, Option_t *option)
/// `filename` is assumed to contain at least two columns of numbers.
/// The string format is by default `"%lg %lg"`.
/// This is a standard c formatting for `scanf()`.
/// For example, set format to `"%lg,%lg"` for a comma-separated file.
///
/// If columns of numbers should be skipped, a `"%*lg"` or `"%*s"` for each column
/// can be added, e.g. `"%lg %*lg %lg"` would read x-values from the first and
Expand Down Expand Up @@ -553,6 +554,10 @@ TGraph::TGraph(const char *filename, const char *format, Option_t *option)
delete token ;
}
infile.close();
if (fNpoints == 0) {
Warning("TGraph", "No points were found in file %s with the specified input format %s", filename, format);
return;
}
}

////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit e3f3f29

Please sign in to comment.