From 6c00fea77e55b7cb1e0179ed3096e0695120ac40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Tue, 16 Apr 2024 16:24:20 +0200 Subject: [PATCH] Fix parsing of white-space only blocks --- src/colvarparse.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/colvarparse.cpp b/src/colvarparse.cpp index 76b5c694c..cf3096ba5 100644 --- a/src/colvarparse.cpp +++ b/src/colvarparse.cpp @@ -592,7 +592,7 @@ int colvarparse::check_keywords(std::string &conf, char const *key) { if (cvm::debug()) cvm::log("Configuration string for \""+std::string(key)+ - "\": \"\n"+conf+"\".\n"); + "\":\n\""+conf+"\".\n"); strip_values(conf); // after stripping, the config string has either empty lines, or @@ -833,7 +833,8 @@ bool colvarparse::key_lookup(std::string const &conf, data_end) + 1; } - if (data != NULL) { + // data_end < data_begin means that the data or block contains only whitespace + if (data != NULL && data_end > data_begin) { data->append(line, data_begin, (data_end-data_begin)); if (cvm::debug()) {