Skip to content

Commit

Permalink
substr before calling stoi (closes #99)
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-martian committed Jul 20, 2024
1 parent 280d375 commit daa1c63
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pattern.cc
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,8 @@ PatternBuilder::write(FILE* output, int longest, vector<pair<int, UString>> inpu
if(s.compare(0, rule_sym_pre.size(), rule_sym_pre) != 0) {
continue;
}
const int rule_num = StringUtils::stoi(s.substr(rule_sym_pre.size()));
size_t pos = rule_sym_pre.size();
const int rule_num = StringUtils::stoi(s.substr(pos, s.size()-pos-1));
transducer.setFinal(src);
finals_rules.insert(make_pair(src, make_pair(rule_num, wgt)));
}
Expand Down

0 comments on commit daa1c63

Please sign in to comment.