From 2dc80e9521e2d9b6001b5f38f3f0637f4d2974ff Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 1 Nov 2020 15:19:52 -0500 Subject: [PATCH] avoid crash in the case of checking an empty potential file --- src/utils.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils.cpp b/src/utils.cpp index 5ae76ed00d..8bd36a8065 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -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:") {