twa_graph: fix precondition on set_init_state
Fixes #391. * spot/twa/twagraph.hh: Here. * tests/core/dualize.test, tests/python/except.py: New tests. * NEWS: Mention the bug.
This commit is contained in:
parent
f29eb91192
commit
8ec6ea838d
4 changed files with 107 additions and 4 deletions
|
|
@ -285,7 +285,10 @@ namespace spot
|
|||
|
||||
void set_init_state(state_num s)
|
||||
{
|
||||
if (SPOT_UNLIKELY(s >= num_states()))
|
||||
bool univ = is_univ_dest(s);
|
||||
if (SPOT_UNLIKELY((!univ && s >= num_states())
|
||||
// univ destinations have at least length 2.
|
||||
|| (univ && 2 + ~s >= g_.dests_vector().size())))
|
||||
throw std::invalid_argument
|
||||
("set_init_state() called with nonexisting state");
|
||||
init_number_ = s;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue