Skip to content

Commit d85b5c2

Browse files
committed
Read null when using SNameNext in the end
1 parent 3aaf7d2 commit d85b5c2

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

presentation/src/main/java/xyz/aprildown/timer/presentation/stream/TimerMachineHelper.kt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -721,13 +721,17 @@ private fun generateVoiceContent(
721721
VoiceAction.VOICE_VARIABLE_STEP_NAME,
722722
VoiceAction.VARIABLE_STEP_NAME -> step.label
723723
VoiceAction.VOICE_VARIABLE_STEP_NAME_NEXT -> {
724-
timer.getStep(
725-
getNextIndexWithStep(
726-
steps = timer.steps,
727-
totalLoop = timer.loop,
728-
currentIndex = index,
729-
).first
730-
)?.label.toString()
724+
if (index is TimerIndex.End) {
725+
null
726+
} else {
727+
timer.getStep(
728+
getNextIndexWithStep(
729+
steps = timer.steps,
730+
totalLoop = timer.loop,
731+
currentIndex = index,
732+
).first
733+
)
734+
}?.label.toString()
731735
}
732736
VoiceAction.VOICE_VARIABLE_STEP_DURATION,
733737
VoiceAction.VARIABLE_STEP_DURATION -> timeFormatter.formatDuration(step.length)

0 commit comments

Comments
 (0)