Skip to content

Commit

Permalink
fix(hid): fill report buffer with 0
Browse files Browse the repository at this point in the history
  • Loading branch information
yume-chan committed Jan 10, 2024
1 parent d5fc810 commit 292dcd2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions libraries/aoa/src/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,14 @@ export class HidKeyboard {
report[0] = this.#modifiers;
let i = 2;
for (const key of this.#keys) {
report[i] = key;
i += 1;
if (i >= 8) {
if (i >= report.length) {
break;
}
report[i] = key;
i += 1;
}
for (; i < report.length; i += 1) {
report[i] = 0;
}
}
}

0 comments on commit 292dcd2

Please sign in to comment.