Skip to content

Commit

Permalink
Fix crash when using Japanese thumb-key (fixes #858)
Browse files Browse the repository at this point in the history
The bug was introduced in commit 0ab4b98 (Implement Drag-and-return & Circular drag (#854)). It was caused by an assumption that the numeric mode of a layout would have at least a one-to-one relation to its main or shifted modes. In this case, the Japanese main/shifted modes have more keys than the numeric mode, which caused an index error.
  • Loading branch information
glm4610 committed Apr 25, 2024
1 parent 1abe5ce commit 13bd2d0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,12 @@ fun KeyboardScreen(
KeyboardMode.MAIN -> keyboardDefinition.modes.shifted
KeyboardMode.SHIFTED -> keyboardDefinition.modes.main
else -> null
}?.arr?.get(i)?.get(j),
}?.arr?.getOrNull(i)?.getOrNull(j),
numericKey =
when (mode) {
KeyboardMode.MAIN, KeyboardMode.SHIFTED -> keyboardDefinition.modes.numeric.arr[i][j]
KeyboardMode.MAIN, KeyboardMode.SHIFTED ->
keyboardDefinition.modes.numeric.arr
.getOrNull(i)?.getOrNull(j)
else -> null
},
dragReturnEnabled = dragReturnEnabled,
Expand Down

0 comments on commit 13bd2d0

Please sign in to comment.