Skip to content

Commit 236929d

Browse files
authored
Update testMetadataHelper.C
1 parent 3b9d809 commit 236929d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Common/Core/macros/testMetadataHelper.C

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,13 @@ std::map<std::string, bool> buildMapForCommitHash(const std::string& hash)
9494
}
9595
std::string lineOfO2VersionsWithHash;
9696
while (std::getline(infileO2Versions, lineOfO2Version)) {
97-
std::string tag = lineOfO2Version.substr(lineOfO2Version.find("O2::") + 4);
97+
// Extract the tag
98+
int stripSize = 4;
99+
std::string tag = lineOfO2Version.substr(lineOfO2Version.find("O2::") + stripSize);
98100
// Strip a trailing "-1" (some alienv entries append this)
99-
if (tag.size() >= 2 && tag.compare(tag.size() - 2, 2, "-1") == 0) {
100-
tag.resize(tag.size() - 2);
101+
stripSize = 2;
102+
if (tag.size() >= stripSize && tag.compare(tag.size() - stripSize, stripSize, "-1") == 0) {
103+
tag.resize(tag.size() - stripSize);
101104
}
102105
LOG(debug) << "Checking tag '" << lineOfO2Version << "' tag (" << tag << ")";
103106
bool found = false;

0 commit comments

Comments
 (0)