File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1845,13 +1845,15 @@ void TFormula::HandleLinear(TString &formula)
18451845 TString expandedFormula = " " ;
18461846 int delimeterPos = 0 ;
18471847 for (std::size_t iTerm = 0 ; iTerm < terms.size (); ++iTerm) {
1848- // determine the position of the "@" operator in the formula
1849- delimeterPos += terms[iTerm].size () + (iTerm == 0 );
1850- if (IsAParameterName (formula, delimeterPos)) {
1851- // append the current term and the remaining formula unchanged to the expanded formula
1852- expandedFormula += terms[iTerm];
1853- expandedFormula += formula (delimeterPos, formula.Length () - (delimeterPos + 1 ));
1854- break ;
1848+ if (iTerm < terms.size () - 1 ) { // N terms, N - 1 @
1849+ // determine the position of the "@" operator in the formula
1850+ delimeterPos += terms[iTerm].size () + iTerm;
1851+ if (IsAParameterName (formula, delimeterPos)) {
1852+ // append the current term and the remaining formula unchanged to the expanded formula
1853+ expandedFormula += terms[iTerm];
1854+ expandedFormula += formula (delimeterPos, formula.Length () - delimeterPos);
1855+ break ;
1856+ }
18551857 }
18561858 SetBit (kLinear , true );
18571859 auto termName = std::string (" __linear" ) + std::to_string (iTerm+1 );
You can’t perform that action at this time.
0 commit comments