This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new 28fa5f87e5 Fix unlikely NPE 28fa5f87e5 is described below commit 28fa5f87e5b91ec4f2776832b67fa3316e087a4c Author: remm <r...@apache.org> AuthorDate: Mon Sep 18 12:53:38 2023 +0200 Fix unlikely NPE Found by coverity. --- java/org/apache/tomcat/util/net/NioEndpoint.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index e7491ea3f9..506a441997 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -1497,8 +1497,12 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel> public SendfileState processSendfile(SendfileDataBase sendfileData) { setSendfileData((SendfileData) sendfileData); SelectionKey key = getSocket().getIOChannel().keyFor(getPoller().getSelector()); - // Might as well do the first write on this thread - return getPoller().processSendfile(key, this, true); + if (key == null) { + return SendfileState.ERROR; + } else { + // Might as well do the first write on this thread + return getPoller().processSendfile(key, this, true); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org