Skip to content

Commit 9c242b4

Browse files
authored
Merge pull request #782 from synonymdev/fix/select-backup-crash
fix: crash in backup confirm mnemonic screen
2 parents 0109a58 + 9eb5051 commit 9c242b4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/src/main/java/to/bitkit/ui/settings/backups/ConfirmMnemonicScreen.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ fun ConfirmMnemonicScreen(
7373
pressedStates = pressedStates,
7474
isComplete = isComplete,
7575
onWordPress = { word, shuffledIndex ->
76-
// Find index of the last filled word
77-
val lastIndex = selectedWords.indexOfFirst { it == null } - 1
76+
val firstNullIndex = selectedWords.indexOfFirst { it == null }
77+
if (firstNullIndex == -1) return@ConfirmMnemonicContent
78+
79+
val lastIndex = firstNullIndex - 1
7880
val nextIndex = if (lastIndex == -1) 0 else lastIndex + 1
7981

8082
// If the word is correct and pressed, do nothing

0 commit comments

Comments
 (0)