Sonar bug: Null pointers should not be dereferenced
@@ -185,9 +185,7 @@ public class PlateBuilder<T> {
private void connectTransitionVariables(VertexDictionary candidateVertices, Plate plate, Map<VertexLabel, VertexLabel> transitionMapping) throws PlateConstructionException {
Collection<Vertex<?>> proxyVertices = plate.getProxyVertices();
- if (candidateVertices == null && !proxyVertices.isEmpty()) {
- throw new IllegalArgumentException("You must provide a base case for the Transition Vertices - use withInitialState()");
- }
+
for (Vertex<?> proxy : proxyVertices) {
VertexLabel proxyLabel = proxy.getLabel().withoutOuterNamespace();
VertexLabel defaultParentLabel = getDefaultParentLabel(proxyLabel);
@@ -197,6 +195,10 @@ public class PlateBuilder<T> {
throw new PlateConstructionException("Cannot find transition mapping for " + proxy.getLabel());
}
+ if (candidateVertices == null) {
+ throw new IllegalArgumentException("You must provide a base case for the Transition Vertices - use withInitialState()");
+ }
+
Vertex<?> parent = candidateVertices.get(parentLabel);
if (parent == null) {
throw new PlateConstructionException("Cannot find VertexLabel " + parentLabel);
