Skip to content

Commit 09e67d8

Browse files
[FIX] RESTXQ: NullPointerException. Closes #2398
1 parent 4f8b98c commit 09e67d8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

basex-api/src/main/java/org/basex/http/restxq/RestXqResponse.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ final class RestXqResponse extends WebResponse {
3333

3434
/** Singleton. */
3535
private RestXqSingleton singleton;
36+
/** Query was registered. */
37+
private boolean registered;
3638
/** Function. */
3739
private RestXqFunction func;
3840
/** Status message. */
@@ -77,6 +79,7 @@ public Response serialize(final boolean body) throws QueryException, IOException
7779
boolean response;
7880

7981
qc.register(ctx);
82+
registered = true;
8083
try {
8184
qc.optimize();
8285

@@ -149,7 +152,7 @@ public Response serialize(final boolean body) throws QueryException, IOException
149152
public void finish() throws IOException, ServletException {
150153
if(qc != null) {
151154
qc.close();
152-
qc.unregister(ctx);
155+
if(registered) qc.unregister(ctx);
153156
}
154157
if(singleton != null) singleton.unregister();
155158
if(forward != null) {

0 commit comments

Comments
 (0)