From a20df96a2f77d790ae3323d90a29ef7c37707b28 Mon Sep 17 00:00:00 2001 From: Lorenzo Rovigatti Date: Fri, 8 Nov 2024 14:29:01 +0100 Subject: [PATCH] Fix a bug whereby the code would hang if bases_file (used by HBEnergy) was not readable --- src/Observables/HBEnergy.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Observables/HBEnergy.cpp b/src/Observables/HBEnergy.cpp index 7cb885d72..8e0cade7b 100644 --- a/src/Observables/HBEnergy.cpp +++ b/src/Observables/HBEnergy.cpp @@ -32,6 +32,9 @@ void HBEnergy::init() { break; case BASES_FROM_FILE: { ifstream inp(_list_file); + if(!inp.good()) { + throw oxDNAException(Utils::sformat("HBEnergy: Can't read bases_file '%s'", _list_file)); + } while(!inp.eof()) { int n; inp >> n;