Skip to content

Commit a0b68eb

Browse files
committed
[bugfix] Report null results instead of throwing NPE
1 parent 658f13b commit a0b68eb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

exist-core/src/main/java/org/exist/client/QueryDialog.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
import org.fife.ui.rtextarea.RTextScrollPane;
7777
import org.xmldb.api.base.Collection;
7878
import org.xmldb.api.base.CompiledExpression;
79+
import org.xmldb.api.base.ErrorCodes;
7980
import org.xmldb.api.base.Resource;
8081
import org.xmldb.api.base.ResourceIterator;
8182
import org.xmldb.api.base.ResourceSet;
@@ -591,6 +592,10 @@ public void run() {
591592
tResult = System.currentTimeMillis() - t1;
592593
runningContext.set(null);
593594

595+
if (result == null) {
596+
throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, "Query returned 'null' which it should never do, this is likely a bug that should be reported");
597+
}
598+
594599
// jmfg: Is this still needed? I don't think so
595600
writer = new StringWriter();
596601
service.dump(compiled, writer);

0 commit comments

Comments
 (0)