Avoid NPE is lastWrite is not being used
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 14 May 2011 21:27:38 +0000 (21:27 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 14 May 2011 21:27:38 +0000 (21:27 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1103228 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/NioBlockingSelector.java

index 192120b..cc0b1d8 100644 (file)
@@ -92,7 +92,7 @@ public class NioBlockingSelector {
             while ( (!timedout) && buf.hasRemaining()) {
                 if (keycount > 0) { //only write if we were registered for a write
                     int cnt = socket.write(buf); //write the data
-                    lastWrite.set(cnt);
+                    if (lastWrite != null) lastWrite.set(cnt);
                     if (cnt == -1)
                         throw new EOFException();
                     written += cnt;