From 8210d068c43058097970fae131643df6b9d9dbdf Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 15 Jul 2010 12:31:25 +0000 Subject: [PATCH] npe protection git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2136 7e9141cc-0065-0410-87d8-b60c137991c4 --- .../org/eclipse/jetty/websocket/WebSocketConnection.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnection.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnection.java index 4da76115069..7fe42017cf2 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnection.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnection.java @@ -129,13 +129,14 @@ public class WebSocketConnection implements Connection, WebSocket.Outbound while(progress) { // take bytes from the parser buffer. - if (_parser.getBuffer().length()>0) + Buffer buffer=_parser.getBuffer(); + if (buffer!=null && buffer.length()>0) { - int l=_parser.getBuffer().length(); + int l=buffer.length(); if (l>8) l=8; - _hixie.put(_parser.getBuffer().peek(_parser.getBuffer().getIndex(),l)); - _parser.getBuffer().skip(l); + _hixie.put(buffer.peek(buffer.getIndex(),l)); + buffer.skip(l); progress=true; }