Skip to content

Commit

Permalink
fix lower_bound can return end()
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajsic committed Sep 20, 2023
1 parent b4bf3ab commit 3380500
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/strings/nfa-strings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ std::set<mata::Symbol> mata::strings::get_accepted_symbols(const Nfa& nfa) {
for (const SymbolPost& symbol_post_init : nfa.delta[init]) {
mata::Symbol sym = symbol_post_init.symbol;
auto symbol_it = accepted_symbols.lower_bound(sym);
if (*symbol_it != sym && nfa.final.intersects_with(symbol_post_init.targets)) {
if ((symbol_it == accepted_symbols.end() || *symbol_it != sym)
&& nfa.final.intersects_with(symbol_post_init.targets)) {
accepted_symbols.insert(symbol_it, sym);
}
}
Expand Down

0 comments on commit 3380500

Please sign in to comment.