avoid crash in the case of checking an empty potential file

This commit is contained in:
Axel Kohlmeyer
2020-11-01 15:19:52 -05:00
parent 4dac7625c5
commit 2dc80e9521

View File

@ -862,6 +862,7 @@ std::string utils::get_potential_date(const std::string &path, const std::string
reader.ignore_comments = false;
char *line = reader.next_line();
if (line == nullptr) return "";
Tokenizer words(line);
while (words.has_next()) {
if (words.next() == "DATE:") {
@ -881,6 +882,7 @@ std::string utils::get_potential_units(const std::string &path, const std::strin
reader.ignore_comments = false;
char *line = reader.next_line();
if (line == nullptr) return "";
Tokenizer words(line);
while (words.has_next()) {
if (words.next() == "UNITS:") {