Skip to content

Commit

Permalink
Fix index-out-of-range (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
sago35 authored Dec 23, 2024
1 parent 75c716b commit 439c09e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions keyboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,12 @@ func (d *Device) Tick() error {

for _, xx := range noneToPress {
kbidx, layer, index := decKey(xx)
x := d.kb[kbidx].Key(layer, index)
switch x & keycodes.QuantumMask {
case keycodes.TypeLxxxT, keycodes.TypeRxxxT:
d.tapOrHold[xx] = time.Now().Add(200 * time.Millisecond)
if kbidx < len(d.kb) {
x := d.kb[kbidx].Key(layer, index)
switch x & keycodes.QuantumMask {
case keycodes.TypeLxxxT, keycodes.TypeRxxxT:
d.tapOrHold[xx] = time.Now().Add(200 * time.Millisecond)
}
}
}

Expand Down

0 comments on commit 439c09e

Please sign in to comment.