[core] Check if the successor vertex exists in StateDescriptorGraph

If the successor's module is disabled then the vertex may be null. In
this case, we can simple continue with the next successor in the list.

Previously, due to d33a5a23c3 ("[core] Introduce
Builder.failOnUnknownStates() and unit tests") this would trigger an
assert in addOutgoingEdge().

Fixes: d33a5a23c3 ("[core] Introduce Builder.failOnUnknownStates() and unit tests")
This commit is contained in:
Florian Schmaus 2021-08-22 16:16:57 +02:00
parent a0b9279441
commit 32a38c4e77
1 changed files with 4 additions and 0 deletions

View File

@ -186,6 +186,10 @@ public class StateDescriptorGraph {
for (GraphVertex<Class<? extends StateDescriptor>> successor : sortedSuccessors) {
GraphVertex<StateDescriptor> successorVertex = successorStateDescriptors.get(successor.element);
if (successorVertex == null) {
// The successor does not exist, probably because its module was not enabled.
continue;
}
node.addOutgoingEdge(successorVertex);
// Recurse further.