Skip to content

Commit 940cf82

Browse files
committed
Catch edge case
1 parent ea9c545 commit 940cf82

File tree

1 file changed

+1
-0
lines changed
  • libraries/Camera/extras/WebSerialCamera

1 file changed

+1
-0
lines changed

libraries/Camera/extras/WebSerialCamera/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ async function readBytes(port, numBytes, timeout = null){
102102
if(value){
103103
for (const byte of value) {
104104
bytesRead[bytesReadIdx++] = byte;
105+
if (bytesReadIdx >= numBytes) break;
105106
}
106107
// count += value.byteLength;
107108
// console.log(`Read ${value.byteLength} (Total: ${count}) out of ${numBytes} bytes.}`);

0 commit comments

Comments
 (0)