From 6943a3da354717404c7dfc6cf242c9e122a79656 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 24 Apr 2021 07:12:45 -0400 Subject: [PATCH] must check if file is readable before changes to internal data --- src/read_data.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/read_data.cpp b/src/read_data.cpp index c0085f19d1..c8937cbfc9 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -304,6 +304,12 @@ void ReadData::command(int narg, char **arg) extra_dihedral_types || extra_improper_types)) error->all(FLERR,"Cannot use read_data extra with add flag"); + // check if data file is available and readable + + if (!utils::file_is_readable(arg[0])) + error->all(FLERR,fmt::format("Cannot open file {}: {}", + arg[0], utils::getsyserror())); + // first time system initialization if (addflag == NONE) {