Skip to content

Commit

Permalink
fix: index out of bounds when calculate offset in Composition view
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiredPlanck committed May 8, 2024
1 parent c484d7f commit 9373ea6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ class Composition(context: Context, attrs: AttributeSet?) : TextView(context, at
*/
private fun calculateOffset(candidates: Array<CandidateListItem>): Int {
if (candidates.isEmpty()) return 0
var j = minOf(minCheckCount, candidates.size, maxCount) - 1
var j = (minOf(minCheckCount, candidates.size, maxCount) - 1).coerceAtLeast(0)
while (j > 0) {
val text = candidates[j].text
if (text.length >= minCheckLength) break
Expand Down

0 comments on commit 9373ea6

Please sign in to comment.