From 23e95ce0adc1fba89d16fcdc3bcd104ea30b741c Mon Sep 17 00:00:00 2001 From: Ondrej Zizka Date: Tue, 2 Dec 2014 06:30:18 +0100 Subject: [PATCH] Prevent NPE - issue #105 --- .../frames/annotations/AdjacencyAnnotationHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/tinkerpop/frames/annotations/AdjacencyAnnotationHandler.java b/src/main/java/com/tinkerpop/frames/annotations/AdjacencyAnnotationHandler.java index 639cf07..bfcff9d 100644 --- a/src/main/java/com/tinkerpop/frames/annotations/AdjacencyAnnotationHandler.java +++ b/src/main/java/com/tinkerpop/frames/annotations/AdjacencyAnnotationHandler.java @@ -48,6 +48,8 @@ public Object processVertex(final Adjacency adjacency, final Method method, fina returnValue = framedGraph.addVertex(null, returnType); newVertex = ((VertexFrame) returnValue).asVertex(); } else { + if (arguments[0] == null) + throw new IllegalArgumentException("null passed to @Adjacency " + method.getName() + " labelled " + adjacency.label()); newVertex = ((VertexFrame) arguments[0]).asVertex(); } addEdges(adjacency, framedGraph, vertex, newVertex); @@ -101,4 +103,4 @@ private void removeEdges(final Direction direction, final String label, final Ve } } } -} \ No newline at end of file +}