From 32a38c4e7776d009f89f6567a2dc9436f06fb767 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 22 Aug 2021 16:16:57 +0200 Subject: [PATCH] [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 d33a5a23c32a ("[core] Introduce Builder.failOnUnknownStates() and unit tests") this would trigger an assert in addOutgoingEdge(). Fixes: d33a5a23c32a ("[core] Introduce Builder.failOnUnknownStates() and unit tests") --- .../java/org/jivesoftware/smack/fsm/StateDescriptorGraph.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/fsm/StateDescriptorGraph.java b/smack-core/src/main/java/org/jivesoftware/smack/fsm/StateDescriptorGraph.java index 35144f73a..41bb29f59 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/fsm/StateDescriptorGraph.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/fsm/StateDescriptorGraph.java @@ -186,6 +186,10 @@ public class StateDescriptorGraph { for (GraphVertex> successor : sortedSuccessors) { GraphVertex 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.