Commit d7d99079 authored by Mikaël Salson's avatar Mikaël Salson

automaton.hpp: Make sure that we have called finish_building()

In an Aho-Corasick automaton (as built here) a transition should always
be defined. Unless we forgot to build the failure functions.

This assertion is there for absent-minded people, it may save them several hours of debugging…
parent e8ab3a56
......@@ -214,7 +214,9 @@ template <class Info>
void *PointerACAutomaton<Info>::next(void *state, char c) {
void *next_state = state;
c = toupper(c);
return ((pointer_state<Info> *)next_state)->transition(c);
void *accessed_state = ((pointer_state<Info> *)next_state)->transition(c);
assert(accessed_state != NULL); // Did you call finish_building()?
return accessed_state;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment