This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new d506092 Fix NPE d506092 is described below commit d506092689a714d80d84a9e898433d6b3f961fed Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Mar 23 12:51:07 2021 +0000 Fix NPE --- java/org/apache/coyote/http2/Stream.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/java/org/apache/coyote/http2/Stream.java b/java/org/apache/coyote/http2/Stream.java index e10fa5c..0fd8cbd 100644 --- a/java/org/apache/coyote/http2/Stream.java +++ b/java/org/apache/coyote/http2/Stream.java @@ -643,8 +643,15 @@ class Stream extends AbstractNonZeroStream implements HeaderEmitter { if (log.isDebugEnabled()) { log.debug(sm.getString("stream.recycle", getConnectionId(), getIdAsString())); } - handler.replaceStream( - this, new RecycledStream(getConnectionId(), getIdentifier(), state, getInputByteBuffer().remaining())); + int remaining; + // May be null if stream was closed before any DATA frames were processed. + ByteBuffer inputByteBuffer = getInputByteBuffer(); + if (inputByteBuffer == null) { + remaining = 0; + } else { + remaining = inputByteBuffer.remaining(); + } + handler.replaceStream(this, new RecycledStream(getConnectionId(), getIdentifier(), state, remaining)); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org