Skip to content

Commit a80ea9c

Browse files
committed
Treat null returned from engine as absence of result
1 parent 3033e59 commit a80ea9c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/com/dbschema/mongo/nashorn/MongoNashornScriptEngine.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ public ResultSet execute(@NotNull String query, int fetchSize) throws SQLExcepti
131131

132132
try {
133133
Object obj = getEngine().eval(query);
134-
if (obj instanceof Iterable) {
134+
if (obj == null) {
135+
return null;
136+
}
137+
else if (obj instanceof Iterable) {
135138
if (obj instanceof MongoIterable) ((MongoIterable<?>) obj).batchSize(fetchSize);
136139
return new ResultSetIterator(((Iterable<?>) obj).iterator());
137140
}

0 commit comments

Comments
 (0)