Another place where we call IDataInput's readBytes. Let's just

make sure we never pass it 0 for the length.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4901 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2007-12-05 02:11:45 +00:00
parent a920f02030
commit c42510b325
+5 -1
View File
@@ -82,7 +82,11 @@ public class FrameReader extends EventDispatcher
// read bytes: either as much as possible or up to the end of the frame
var toRead :int = Math.min(_length - _curData.length,
_socket.bytesAvailable);
_socket.readBytes(_curData, _curData.length, toRead);
// Just in case, if the amount needed is 0, don't do anything!
// Passing 0 causes it to read *all available bytes*.
if (toRead != 0) {
_socket.readBytes(_curData, _curData.length, toRead);
}
if (_length === _curData.length) {
// we have now read a complete frame, let us dispatch the data