Skip to content

Commit ca797a8

Browse files
committed
[UNDERTOW-1507] Add null checks on HttpClientConnection.ClientReadListener#handleEvent()
Issue: https://issues.jboss.org/browse/UNDERTOW-1507
1 parent a7477cd commit ca797a8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

core/src/main/java/io/undertow/client/http/HttpClientConnection.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,10 @@ public void handleEvent(StreamSourceChannel channel) {
556556
UndertowLogger.CLIENT_LOGGER.debugf(e, "Connection closed with IOException");
557557
}
558558
try {
559-
currentRequest.setFailed(e);
560-
currentRequest = null;
559+
if (currentRequest != null) {
560+
currentRequest.setFailed(e);
561+
currentRequest = null;
562+
}
561563
pendingResponse = null;
562564
} finally {
563565
safeClose(channel, HttpClientConnection.this);
@@ -575,8 +577,10 @@ public void handleEvent(StreamSourceChannel channel) {
575577
channel.suspendReads();
576578
try {
577579
// Cancel the current active request
578-
currentRequest.setFailed(new IOException(MESSAGES.connectionClosed()));
579-
currentRequest = null;
580+
if (currentRequest != null) {
581+
currentRequest.setFailed(new IOException(MESSAGES.connectionClosed()));
582+
currentRequest = null;
583+
}
580584
pendingResponse = null;
581585
} finally {
582586
safeClose(HttpClientConnection.this);

0 commit comments

Comments
 (0)