npe protection

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2136 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-07-15 12:31:25 +00:00
parent 47bd78a37f
commit 8210d068c4
1 changed files with 5 additions and 4 deletions

View File

@ -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;
}