Skip to content

Commit d891e9c

Browse files
committed
EAMxx: add an additional check for multiple ":="
1 parent 1a348d8 commit d891e9c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

components/eamxx/src/share/io/eamxx_io_utils.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "share/util/eamxx_utils.hpp"
66
#include "share/eamxx_config.hpp"
77

8-
#include "ekat/util/ekat_string_utils.hpp"
8+
#include <ekat_string_utils.hpp>
99

1010
#include <fstream>
1111
#include <regex>
@@ -252,7 +252,11 @@ parse_field_alias (const std::string& field_spec)
252252
EKAT_REQUIRE_MSG(!alias.empty() && !field_name.empty(),
253253
"Error! Invalid field alias specification: '" + field_spec + "'\n"
254254
"Expected format: 'alias:=field_name' where both alias and field_name are non-empty.\n");
255-
255+
256+
auto another_pos = field_name.find(delimiter);
257+
EKAT_REQUIRE_MSG(another_pos == std::string::npos,
258+
"Error! Invalid field alias specification: '" + field_spec + "'\n"
259+
"Multiple ':=' tokens found.\n");
256260
return {alias, field_name};
257261
}
258262

0 commit comments

Comments
 (0)