1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 06:12:05 +01:00

[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

View file

@ -186,6 +186,10 @@ public class StateDescriptorGraph {
for (GraphVertex<Class<? extends StateDescriptor>> successor : sortedSuccessors) { for (GraphVertex<Class<? extends StateDescriptor>> successor : sortedSuccessors) {
GraphVertex<StateDescriptor> successorVertex = successorStateDescriptors.get(successor.element); 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); node.addOutgoingEdge(successorVertex);
// Recurse further. // Recurse further.