diff --git a/src/main/java/com/complexible/stardog/plan/aggregates/Agg.java b/src/main/java/com/complexible/stardog/plan/aggregates/Agg.java index e712296..d5ea1b5 100644 --- a/src/main/java/com/complexible/stardog/plan/aggregates/Agg.java +++ b/src/main/java/com/complexible/stardog/plan/aggregates/Agg.java @@ -117,8 +117,10 @@ protected ValueOrError _getValue() { return ValueOrError.General.of(output_value); } } finally { - instance.close(); - instance = null; + if(instance != null) { + instance.close(); + instance = null; + } } }