Skip to content

Commit

Permalink
Allow to empty constant values (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener authored Feb 16, 2024
1 parent 8423045 commit 2c428cd
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions source/src/XMLParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -873,16 +873,14 @@ namespace marlin{
}

const std::string key( value.substr( pos+2 , pos2-pos-2 )) ;
auto findConstant = constants.find( key ) ;
const std::string replacementValue( findConstant != constants.end() ? findConstant->second : "" ) ;

if( replacementValue.empty() ) {

const auto findConstant = constants.find( key ) ;
if (findConstant == constants.end()) {
std::stringstream str ;
str << "XMLParser::performConstantReplacement : constant \"" << key << "\" not found in available constants !" ;
throw ParseException( str.str() ) ;
}

const auto& replacementValue = findConstant->second;

value.replace( pos , (pos2+1-pos) , replacementValue ) ;
pos2 = pos + replacementValue.size() ; // new end position after replace

Expand Down

0 comments on commit 2c428cd

Please sign in to comment.