Skip to content

Commit

Permalink
returning a 0 length array when position -1
Browse files Browse the repository at this point in the history
  • Loading branch information
felHR85 committed Jan 4, 2018
1 parent 09a3f86 commit e9d27bb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.android.tools.build:gradle:2.2.3'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public synchronized byte[] get()
e.printStackTrace();
}
}
if(position <= -1 ) return new byte[DEFAULT_READ_BUFFER_SIZE];
if(position <= -1 ) return new byte[0];
byte[] dst = Arrays.copyOfRange(buffer, 0, position);
if(debugging)
UsbSerialDebugger.printLogGet(dst, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ public void run()
while(working.get())
{
byte[] data = serialBuffer.getWriteBuffer();
connection.bulkTransfer(outEndpoint, data, data.length, USB_TIMEOUT);
if(data.length > 0)
connection.bulkTransfer(outEndpoint, data, data.length, USB_TIMEOUT);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public void run()
while(working.get())
{
byte[] data = serialBuffer.getWriteBuffer();
connection.bulkTransfer(outEndpoint, data, data.length, USB_TIMEOUT);
if(data.length > 0)
connection.bulkTransfer(outEndpoint, data, data.length, USB_TIMEOUT);
}
}

Expand Down

0 comments on commit e9d27bb

Please sign in to comment.